[wp-trac] [WordPress Trac] #32762: Comment meta queries cannot be set in WP_Comment_Query via pre_get_comments

WordPress Trac noreply at wordpress.org
Tue Jun 23 14:35:31 UTC 2015


#32762: Comment meta queries cannot be set in WP_Comment_Query via pre_get_comments
--------------------------+---------------------------
 Reporter:  needle        |       Owner:  boonebgorges
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:  4.3
Component:  Comments      |     Version:  4.2
 Severity:  normal        |  Resolution:  fixed
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------------
Changes (by boonebgorges):

 * owner:   => boonebgorges
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"32911"]:
 {{{
 #!CommitTicketReference repository="" revision="32911"
 In `WP_Comment_Query`, parse meta_query vars after the `pre_get_comments`
 hook.

 [31467] included a change that involved generating meta_query SQL before
 the
 `pre_get_comments` hook, with the result that `pre_get_comments` callbacks
 were
 no longer able to modify comment meta queries. We fix the problem by
 moving the
 SQL generation to after the hook.

 This changeset also includes a second call to
 `meta_query->parse_query_vars()`,
 to ensure that modifications to metadata-related query vars (such as
 `meta_key`
 and `meta_value`) performed in `pre_get_comments` callbacks have the
 expected
 effect on the comment query.

 Fixes #32762.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32762#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list