Hello,
I currently use a WP_Query to display the most recent articles using a shortcode.
The WP_Query is this one:
$the_query = new WP_Query( array(
‘cat’ => $category->term_id,
‘posts_per_page’ => 5,
‘order’ => ‘desc’,
‘orderby’ => ‘modified’
)
I would like to know if, to display the most visited articles instead of the most recent ones, I could use this WP_Query here:
$the_query = new WP_Query( array(
‘cat’ => $category->term_id,
‘posts_per_page’ => 5,
‘meta_key’ => ‘post_views_count’,
‘orderby’ => ‘meta_value_num’
)
Thanks