[wp-trac] [WordPress Trac] #26343: has_shortcode not recognizing nested shortcodes
WordPress Trac
noreply at wordpress.org
Sat Jul 19 10:18:56 UTC 2014
#26343: has_shortcode not recognizing nested shortcodes
-----------------------------------+-----------------------------
Reporter: sunyatasattva | Owner: wonderboymusic
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 4.0
Component: Shortcodes | Version: 3.6
Severity: normal | Resolution:
Keywords: has-patch 2nd-opinion | Focuses:
-----------------------------------+-----------------------------
Comment (by engelen):
Thanks @aaroncampbell, you've voiced my opinion perfectly. `has_shortcode`
is not intended as a function for a simple string match on a content
string. It's intended for checking whether a piece of content contains a
shortcode that gets executed. Nested shortcodes aren't executed by
WordPress core, because the raw content between shortcode opening and
closing tags is handled by the shortcode's callback function. Thus,
`has_shortcode` should not look for nested shortcodes by default.
However, this is purely theoretical: this isn't a bug, it's intended
behaviour (otherwise, the function wouldn't fully parse the content for
shortcodes in the same way `do_shortcode` does), and we thus have to
maintain backwards compatibility. Therefore, `$recursive` must be `false`
by default.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/26343#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list