POSTS list in WordPress by views
Seems like you already have the custom field for views set up since that’s a phpMyAdmin screenshot. If so, you can use order_by=”post_views_count” in most wp_query based calls. For instance: $args = array( ‘post_type’ => ‘your_post_type’, ‘orderby’ => ‘meta_value_num’, ‘meta_key’ => ‘post_views_count’, ); $query = new WP_Query( $args ); //…and on with the loop <?php … Read more