[wp-trac] [WordPress Trac] #23469: Comment meta query is parsed before the pre_get_comments filter

WordPress Trac noreply at wordpress.org
Tue Feb 19 08:44:52 UTC 2013


#23469: Comment meta query is parsed before the pre_get_comments filter
-----------------------------------------+------------------------------
 Reporter:  kasparsd                     |       Owner:
     Type:  defect (bug)                 |      Status:  new
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Comments                     |     Version:  3.5
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |
-----------------------------------------+------------------------------

Comment (by kasparsd):

 Replying to [comment:5 nacin]:
 > Seems like WP_Query has opposite behavior.

 WP_Query parses the meta query '''after''' the 'pre_get_posts' gets
 applied: http://core.trac.wordpress.org/browser/tags/3.5.1/wp-
 includes/query.php#L1934. And it makes sense, because you would need to
 manually run `$query->meta_query->parse_query_vars( $query->query_vars );`
 every time you modify something related to the meta query.


 Replying to [comment:3 SergeyBiryukov]:
 > The suggested patch would make `$this->meta_query` object inaccessible
 for the hooked functions.

 Exactly, just like WP_Query doesn't make the parsed meta_query available
 on `pre_get_posts`.

 In your `pre_get_posts` filters you don't have to manually `parse_query`
 to actually apply the changes, so it shouldn't be required for changes to
 meta_query either.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23469#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list