Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example query for popular posts (i.e., posts with most views)
* 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