[wp-trac] [WordPress Trac] #14481: Shortcode Enhancements

WordPress Trac wp-trac at lists.automattic.com
Thu Aug 5 00:36:35 UTC 2010


#14481: Shortcode Enhancements
-------------------------+--------------------------------------------------
 Reporter:  deadowl      |       Owner:                 
     Type:  enhancement  |      Status:  new            
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Shortcodes   |     Version:  3.0            
 Severity:  normal       |    Keywords:  has-patch      
-------------------------+--------------------------------------------------

Comment(by aaroncampbell):

 Replying to [comment:15 scribu]:
 > Ok, so why not use do_action() and add_action() internally?
 I think I agree with Scribu (assuming I'm understanding what he's saying).
 It would be nice to be able to use filters, but it would require that the
 parameters be changed so the content parameter comes first...which REALLY
 messes with backwards compatibility.  The only way I see to be able to
 rearrange parameters would be to create new functions (like
 wp_add_shortcode, or something similar) and use a function with the old
 functions that rearranges the parameters before calling their handler.  It
 would be messy, but the end result would be pretty nice:

 Basically, when someone did `add_shortcode('myshortcode', 'myhandler',
 10);` internally it would do something like `add_filter('shortcode-
 myshortcode', 'myhandler', 10, 3);` and then when it processed shortcodes
 it would simply use `apply_filters('shortcode-myshortcode', $content,
 $attributes, $tag);`

 You would obviously also be able to use has_filter, remove_filter, and
 even remove_all_filters.

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


More information about the wp-trac mailing list