WordPress.org

Make WordPress Core

Changes between Version 4 and Version 5 of Ticket #17019, comment 18


Ignore:
Timestamp:
04/07/11 08:10:11 (4 years ago)
Author:
kevinB
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #17019, comment 18

    v4 v5  
    1313}}} 
    1414 
    15 causes my_function to be executed every time WP_Query applies filters for any query; I have no choice.   
     15causes my_function to be executed every time WP_Query applies filters for any query; I have no choice.  Same for my_function2 and my_function3 which also want to filter posts_where within the same http request, but for different queries. Each one, when hooked directly to posts_where, will each be executed every N times posts_where filters are applied.   
    1616 
    17 Same for my_function2 and my_function3 which also want to filter posts_where within the same http request, but for different queries. Each one, when hooked directly to posts_where, will each be executed every N times posts_where filters are applied.  Is there not some overhead in needless call_user_func_array() calls? 
     17Yes, I can use the context arg to return the value unfiltered, but isn't that needless overhead which will be noted as plugin performance drag but could be avoided via more strategic '''filter application'''? 
    1818 
    19 So as it stands, my plugin code will instead hook '''one''' function to posts_where and let it route the traffic.  But most plugin / theme authors won't bother to do that, so I thought it would be better to just skip the call_user_func_array() when a context mismatch is known. 
    20  
     19So as it stands, my plugin code will work around this by instead hooking '''one''' function to posts_where and letting it route the traffic.  But most plugin / theme authors won't bother to do that, so I thought it would be better to just skip the call_user_func_array() when a context mismatch is known.