[wp-trac] [WordPress Trac] #24990: Nested Shortcode Inside [caption]
WordPress Trac
noreply at wordpress.org
Wed Oct 8 10:10:48 UTC 2014
#24990: Nested Shortcode Inside [caption]
----------------------------------------+-----------------------------
Reporter: prionkor | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Media | Version: 3.6
Severity: normal | Resolution:
Keywords: needs-unit-tests has-patch | Focuses:
----------------------------------------+-----------------------------
Comment (by pputzer):
Replying to [comment:8 nofearinc]:
> pputzer, I was able to replicate the issue above (wasn't clear for me at
first) and the shortcode is not the problem there as a literal would be
skipped as well.
>
> IIRC we only support 2 versions before the current release, so probably
removing the regex test at all?
The regex converts the ''new'' syntax to the old one, so I don't think it
can be removed completely (even if it were the other way around, old
content would be broken by the change). To allow for at least one level of
nested shortcodes in the {{{$content}}}, something like the following
regex (not tested) could be used as a generalization of my specific
workaround:
{{{
if ( preg_match( '#((?:\[([^\]]+)\]\s*)(?:<a [^>]+>\s*)?<img
[^>]+>(?:\s*</a>)?(?:\s*\[/\2\])?)(.*)#is', $content, $matches ) ) {
$content = $matches[1];
$attr['caption'] = trim( $matches[3] );
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/24990#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list