Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example query for popular posts (i.e., posts with most views)
<?php
/**
* Example query: Posts ordered by most views
*
*/
$args = (
'meta_key' => 'views',
'orderby' => 'meta_value_num',
'order' => 'DESC',
);
$posts = get_posts( $args );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.