Skip to content

Instantly share code, notes, and snippets.

@wp-user-manager
Created January 2, 2023 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wp-user-manager/cc6f354876b1a7716e22ef393592d119 to your computer and use it in GitHub Desktop.
Save wp-user-manager/cc6f354876b1a7716e22ef393592d119 to your computer and use it in GitHub Desktop.
WP User Manager - WP_Query ordering posts by the most likes
<?php
$args = array(
'post_status' => 'publish',
'post_type' => 'post',
'meta_key' => 'wpum_likes',
'orderby' => 'meta_value_num',
'order' => 'DESC'
);
$query = new WP_Query($args);
@wp-user-manager
Copy link
Author

Requires the Likes addon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment