[wp-trac] [WordPress Trac] #50521: comments_pre_query doesn't align with other pre_query filters
WordPress Trac
noreply at wordpress.org
Wed Jul 1 21:57:02 UTC 2020
#50521: comments_pre_query doesn't align with other pre_query filters
--------------------------+------------------------------
Reporter: dinhtungdu | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+------------------------------
Comment (by adamsilverstein):
Thanks for clarifying that `get_comments` is called when
`WP_comment_query` is initialized with query args, that clears up the
issue you are trying to resolve.
> Agreed. And we have the naming problem exists for the method name as
well, with count set to true, WP_Comment_Query::get_comments() return the
count, not the comments.
I don't think we can change the naming at this point. I do think we can
set the $comments_query->comments to the comments or the comment ids as
you are suggesting; in the case where a count is requested we should not
set anything since we only have and only requested a count.
Can you update your patch to add that logic?
We will need to document this change for developers; this change shouldn't
break anything for existing uses so should be safe to add.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50521#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list