[wp-trac] [WordPress Trac] #18236: Change hook 'post_edit_form_tag' from an action to a filter

WordPress Trac wp-trac at lists.automattic.com
Thu Jul 28 07:55:39 UTC 2011


#18236: Change hook 'post_edit_form_tag' from an action to a filter
------------------------------------+------------------------------
 Reporter:  mikeschinkel            |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Upload                  |     Version:  3.2.1
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+------------------------------

Comment (by mikeschinkel):

 Replying to [comment:1 dd32]:
 > > is backwards compatible with existing plugins
 >
 > Not really. Any functions hooked as an action would return null,

 If the action returns `null` then the `echo` echos nothing. An action
 won't be there unless is actually does the echo. So it is 100% backwards
 compatible because it will behave exactly like it does with the action.

 > if they return after a filter hooked function, the value of the filter
 is effectivly ignored, correct?

 But 1.) that does make it not backward compatible because today nobody is
 using filters for this ''(unless they are screwing up)'', and 2.) for
 future filters added then your concern is only relevant if someone writes
 a new filter that gets nullifying by a later priority action, but that is
 100% possible with filters already if the later filter decides to eat the
 value.  So just document in the code that filters may get overridden by
 legacy hooks. Better than the current case of outputting invalid HTML.

 > Yeah, an action here is kind of messy, but it was consistent with other
 areas. As dd32 said, attached actions will nuke filters, and then it's a
 priorities game.

 But filters can nuke filter so I don't see how this is a justification for
 leaving it as is.

 > One could do remove_all_actions( 'post_edit_form_tag' ), no?

 Only if you know what actions to remove and which ones not to remove. Who
 knows what some plugin is doing as a side-effect in their
 `'post_edit_form_tag'`?  All you alternatives seem a lot worse than just
 putting the burden on the future writers of filters to use a higher
 priority.

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


More information about the wp-trac mailing list