[wp-trac] [WordPress Trac] #32445: `is_callable()` should be checked in `do_shortcode_tag()`, not `add_shortcode()`

WordPress Trac noreply at wordpress.org
Tue May 19 21:25:23 UTC 2015


#32445: `is_callable()` should be checked in `do_shortcode_tag()`, not
`add_shortcode()`
----------------------------+------------------
 Reporter:  wonderboymusic  |       Owner:
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  4.3
Component:  Shortcodes      |     Version:  2.6
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+------------------
Changes (by wonderboymusic):

 * keywords:  needs-patch => has-patch


Comment:

 Another piece here - if you register a shortcode now without a valid
 callback, you get no notice in the logs and nothing happens to your
 shortcode (it isn't parsed).

 [attachment:32445.diff 32445.diff] is all of the code that is required to
 make shortcode registration possible in `default-filters.php`. The only
 major diff is having to load `shortcodes.php` before `default-filters.php`
 in the bootstrap.

 In my patch, when a shortcode is being parsed and doesn't have a valid
 callback, a `_doing_it_wrong()` is fired. `_doing_it_wrong()` can't be
 called on `add_shortcode()` in `default-filters.php` because i10n is not
 loaded.

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


More information about the wp-trac mailing list