# Custom Queries by Likes

URL: https://wpusermanager.com/article/324-custom-queries-by-likes/
Last updated: 2023-01-02

Although the data for all the user likes is stored in a custom table, the count of likes for each post is stored in post meta with the key 'wpum\_likes'. This makes it easy to query and sort posts using the [WP\_Query](https://developer.wordpress.org/reference/classes/wp_query/) function.

For example, you can get all posts ordered by those with the most likes with this code:

https://gist.github.com/wp-user-manager/cc6f354876b1a7716e22ef393592d119
