How to order posts query by views number?

[ad_1]

Hi @pepe543,

Not sure to be honest. I have never tried something like that so I can’t say for sure.

I guess something like ?orderby=meta_value&meta_key=views_total or ?orderby=meta_value_num&meta_key=views_total may work? Give it a try and report back your results.

  • This reply was modified 2 hours, 56 minutes ago by Héctor Cabrera. Reason: Edited for brevity and better formatting

Yeah,
Found a solution here:
https://wordpress.stackexchange.com/questions/269105/orderby-post-views

Also, I would like to ask, if it’s possible to use the wpp plugin, to create something like a view count for custom taxonomies (like actors).
Not so much to keep a historical view count, but more to create a weekly popularity ranking. (Without blowing up the server performance).

You can lock this topic.
Thanks again.

Found a solution here

Nice! Thanks for sharing.

I thought about that too but figured that maybe WordPress already provided that feature out of the box. I suppose that’s not the case then?

Also, I would like to ask, if it’s possible to use the wpp plugin, to create something like a view count for custom taxonomies (like actors).

Unfortunately no, WPP doesn’t track taxonomy (tags, categories, etc.) page views precisely because of performance. (Plus the name of the plugin is WordPress Popular Posts, not WordPress Popular Taxonomies nor WordPress Popular Items :P)

The data is sort of there already though: you could get the views count of every post/page/CPT linked to a specific taxonony, sum everything and you’d get the total amount of views related to it. This would likely require writing some custom database queries and whatnot but I guess you get the idea.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer