Question for Advanced Developers
-
Here is an advanced challenge that I am struggling with.
I am developing a plugin which, as part of the functionality, saves user_ids to the wp-postmeta table with post_id. For each post there may be multiple user ids, or none.
Anyway, what I am trying to achieve is the option of ordering posts by a count of the user_ids in the wp_postmeta table (in descending order).
The route I have been taking is to use the ‘add_filter’ hook with ‘posts_where’, ‘posts_join’, and ‘posts_orderby’. These only kick in if the variable ‘&show=count’ is added the url to index.php.
However I can’t seem to get the query to order by the count of the user_ids.
If someone out there can point me in the right direction I will be very grateful.
Cheers
Lee
- The topic ‘Question for Advanced Developers’ is closed to new replies.