I have a php file that is working outside wordpress's plugin and template system, and I am calling get_post to get the post's content. Does it count as a post view?


WordPress doesn't count post views. So no. Nothing counts as a post view.

If you're using a plugin or service that counts post views, then it would depend on that plugin or service, and how it measures views. You'd need to ask its author, but I feel safe saying that none of them would use get_post() to count views.

  • Just a remark. I don't use get_post to count view. Just worried about if by using get_post, it would automatically up the view count in the post. – user3332522 Sep 5 at 8:45
  • If in doubt, you can test if it ups the post count by calling get_post lots of time on the same post ID. But think of it this way, if it did increase the post count then viewing a category archive would increase the post count of every post shown on the page. get_post just fetches the data in PHP, it won't render the page and execute any traffic stat JS libraries – Tom J Nowell Sep 5 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.