[wp-trac] [WordPress Trac] #19321: get_search_form() function calls an action and a filter with the same hook.

WordPress Trac noreply at wordpress.org
Fri Mar 22 17:37:31 UTC 2013


#19321: get_search_form() function calls an action and a filter with the same hook.
--------------------------+------------------
 Reporter:  marquex       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.6
Component:  Template      |     Version:  2.7
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------
Changes (by SergeyBiryukov):

 * keywords:   => has-patch
 * milestone:  Awaiting Review => 3.6


Comment:

 > The get_search_form() functions starts calling the action
 'get_search_form', and its ends applying the filter 'get_search_form' if a
 searchform.php file doesn't exists.

 With the changes in #16541, the filter is now applied if `searchform.php`
 exists as well.

 If a function is hooked to `get_search_form` as an action (e.g. to print
 something), it runs twice, so the output is printed twice. If it's hooked
 as a filter, it still runs twice, but at least properly returns the value.

 I guess we should rename the action. I'd suggest `get_search_form_before`.

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


More information about the wp-trac mailing list