[wp-trac] [WordPress Trac] #33492: Slightly better add_filter

WordPress Trac noreply at wordpress.org
Sat Aug 22 13:39:53 UTC 2015


#33492: Slightly better add_filter
-------------------------+------------------------------
 Reporter:  Iazel        |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by Iazel):

 Replying to [comment:3 dd32]:
 > Since we can't enforce it that other plugins won't have a similarly
 named function, or that plugin authors would use their plugin slug, that
 raises the possibility of conflicts. Sure, it's a small case, but it's one
 that exists.
 It's the same thing with named function, isn't it? I could also inject
 some very common function name, like:
 {{{#!php
 <?php
 function format_content($content) { /* code */ }
 add_filter('the_content', 'format_content');
 }}}
 I could do that, but anyone who want to publish his plugin know that he
 must give his function a good name that will not cause conflicts. With
 this small addition, who want to use a function doesn't need to think
 about it anymore, just use the plugin domain (that it's already specific)
 and you're done :)

 Regarding the other points, I can't say much because that's your opinion,
 programming is also nice because you can do it in your way and I think
 this change respects that principle :)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33492#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list