[wp-trac] [WordPress Trac] #25435: Intoduce function for use instead of do_shortcode( '[shortcode]' )

WordPress Trac noreply at wordpress.org
Sat Sep 28 20:47:27 UTC 2013

#25435: Intoduce function for use instead of do_shortcode( '[shortcode]' )
 Reporter:  jdgrimes         |      Owner:
     Type:  feature request  |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Shortcodes       |    Version:
 Severity:  normal           |   Keywords:  has-patch
 There are times when we want to call a shortcode programmatically.
 Currently, the easiest way to do this is `do_shortcode( '[shortcode]' )`.
 But that does lots of unnecessary work. A developer has two alternatives:
 1. Manually search through the source and find the function that handles
 the shortcode, and call it directly. The only problem is that this doesn't
 offer a very forward-compatible solution, especially when the shortcode is
 being offered by a plugin.
 1. Search through `$shortcode_tags` to find and call the function. That's
 more forward-compatible, but it kind of seems hacky.

 I'd like to request that we offer a core function that does number 2
 rather than each developer having to implement it themselves.


 call_shortcode_func( 'shortcode', $atts, $content );

 (We can change the name of the function.)

 Patch forthcoming.

Ticket URL: <http://core.trac.wordpress.org/ticket/25435>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list