[wp-trac] [WordPress Trac] #47616: Enhancement: doing_shortcode() function similar to doing_filter()

WordPress Trac noreply at wordpress.org
Thu Jun 27 12:42:53 UTC 2019


#47616: Enhancement: doing_shortcode() function similar to doing_filter()
---------------------------+-----------------------------
 Reporter:  keraweb        |      Owner:  (none)
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Shortcodes     |    Version:
 Severity:  normal         |   Keywords:
  Focuses:  accessibility  |
---------------------------+-----------------------------
 Currently there is no way to determine whether the current code is run
 from a shortcode callback.
 Similar to actions and filters it would be nice to have a
 `doing_shortcode()` function.

 My idea is to have an optional parameter for the shortcode tag.
 If the parameter is passed it will check if that exact shortcode is
 running.
 If no parameter is passed it will return true if any shortcode is running.

 Though I believe it's not officially supported, if shortcodes are
 triggered within shortcodes it would be best to keep an array of current
 shortcodes and only remove an active shortcode tag if the callback is
 finished.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47616>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list