[wp-hackers] pre_get_comments hook only runs for non logged-in users

John Blackbourn johnbillion+wp at gmail.com
Fri Jun 17 21:51:28 UTC 2011

On 17 June 2011 22:45, Joseph Carrington <joseph.carrington at gmail.com> wrote:
> Is this a bug, or a feature? If it's a feature, how would you recommend I change the orderby of comments for logged in users?

The pre_get_comments hook fires for all users. It's contained within
the function that queries comments, so if you're fetching comments
using the normal method (eg get_comments() or wp_list_comments() )
then this hook will fire.

You might want to check that another plugin (or your theme) isn't
doing something funky with comments (eg fetching them with a direct
SQL query).

More information about the wp-hackers mailing list