#35183 closed defect (bug) (wontfix)
Nested shortcode breaks wp.shortcode.replace() functionality
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.4 |
Component: | Shortcodes | Keywords: | |
Focuses: | ui, javascript, administration | Cc: |
Description
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.
Change History (3)
Note: See
TracTickets for help on using
tickets.
I am not sure if shortcodes inside attributes have ever worked but the codex says that:
See: http://codex.wordpress.org/Shortcode_API#Square_Brackets