Skip to content

Instantly share code, notes, and snippets.

@web-hat
Created March 22, 2017 18:07
Show Gist options
  • Save web-hat/4b5b3a7cb4141178ec22b08197306b13 to your computer and use it in GitHub Desktop.
Save web-hat/4b5b3a7cb4141178ec22b08197306b13 to your computer and use it in GitHub Desktop.
Display Popular Posts by Views in WordPress without a Plugin
<?php
$args = [
//...
'meta_key' => 'whpp_track_post_views',
'orderby' => 'meta_value_num',
'order' => 'DESC',
//...
];
$query = new WP_Query($args);
//...
//...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment