<span class="resolved" aria-label="Resolved" title="Topic is resolved."></span>A Better Way to Sort

[ad_1]

Replies: 2

Thanks to this article, we were able to implement the ability to sort by number of views.

However, this method is not in the order of the Most viewed tab on the stats page.
This is because the meta field values are only updated when the page is viewed, and the meta field values for pages that have not been viewed for a long time will remain the same.

Example:
If a page with a ‘views_daily’ value of 5 is not viewed by anyone for 24 hours, the value will remain 5 after 24 hours.

The solution is to periodically update the meta field for all articles. However, this is not practical if there are many pages.

It is not a bad idea to specify a time period in the query. It won’t be the same as the stats page, but it is easier.

 

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