Display Popular Posts by Views in WordPress without a Plugin

If you don't have comments on a post then how to order post by popularity? Why not order it by view count with a simple hack!

By default WordPress does not allow to show or order post by views, so we have to use a little trick which can make our blog a much more lively.
So let get started, first, we ‘ll create a custom post meta as whpp_track_post_views, then on every post visit we have to increase the counter by one.

Now that we have set the custom post meta we need to add following code in WP_Query to short post my view

Some of the related question in StackOverflow, which might come handy:
Default image
Raunak Gupta
I'm an expert Laravel, WooCommerce, WordPress theme and plugin developer, over the time I have developed several sites and applications. I like to help the upcoming developer, So I share my experience through this blog.
Articles: 18

One comment

  1. Keep on writing, great job!

Leave a Reply to impressCancel Reply