[wp-trac] [WordPress Trac] #35183: Nested shortcode breaks wp.shortcode.replace() functionality
WordPress Trac
noreply at wordpress.org
Mon Dec 21 13:00:08 UTC 2015
#35183: Nested shortcode breaks wp.shortcode.replace() functionality
--------------------------------------------+-----------------------------
Reporter: prionkor | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Shortcodes | Version: 4.4
Severity: normal | Keywords:
Focuses: ui, javascript, administration |
--------------------------------------------+-----------------------------
I am going to give two simple examples of what I've found so far. Also
note that this bug may be present in PHP api too (not tested) if the regex
is same.
{{{
// the code below will work perfectly fine
var text = "This is some content with shortcode. [foo title="Call Us"]this
is content[/foo]
text = wp.shortcode.replace('foo', text, function(tag){
return '<p>Foo shortcode preview</p>';
});
}}}
{{{
// the shortcode tag inside callbacks gets wrong and broken value when
there is a shortcode inside attribute value.
var text = "This is some content with shortcode. [foo title="Call Us at
[phone]"]this is content[/foo]
text = wp.shortcode.replace('foo', text, function(tag){
// attributes and content values are broken.
return '<p>Foo shortcode preview</p>';
});
}}}
It seems if we have any nested shortcode inside the attribute value the
attributes and contents are broken inside the shortcode object.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35183>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list