[wp-trac] [WordPress Trac] #17019: context arg for WP_Query filter application

WordPress Trac wp-trac at lists.automattic.com
Thu Apr 7 06:50:20 UTC 2011

#17019: context arg for WP_Query filter application
 Reporter:  kevinB       |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Query        |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |

Comment (by kevinB):

 Replying to [comment:13 nacin]:
 > Adding a context filter to all hooks is going to be way worse
 performance wise than adding a filter only exactly when you want it.

 I didn't propose adding an additional filter to all hooks. Where do you
 see that?

 The change was to make apply_filters_ref_array(), before calling each
 hooked filter as it currently does, to check whether that filter was added
 with a context arg... and if so, to '''not''' call it if the current
 context doesn't match.

 The changes to WP_Query and plugin.php were to apply fewer filters, not
 more.  So is the performance concern for the isset / empty statements?
 The is_array() check in add_filter?  Or the optional arg to

Ticket URL: <http://core.trac.wordpress.org/ticket/17019#comment:14>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list