Query by post view count
-
Hello everybody,
Could anyone please help me if it’s possible to make a wp_query using the view count as a parameter to order posts?
I’ve tried this, but it didn’t work:
<?php
$args = array(
‘post_type’ => ‘noticias’,
‘posts_per_page’ => ‘6’,
‘meta_key’ => ‘a3_pvc_total_views’,
‘orderby’ => ‘meta_value_num’,
‘order’ => ‘DESC’
);
$query = new WP_Query( $args );
if( $query->have_posts() ):
while ( $query->have_posts() ) : $query->the_post();
the_title();
endwhile;
endif;
wp_reset_query();
?>Thank you, best regards
The topic ‘Query by post view count’ is closed to new replies.