id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,focuses
21257,Shortcode not working when another earlier defined shortcode contains new shortcode,dannydehaan,,"Hi All,
Hope my summary is clear enough.
The problem.
When you want to register a new shortcode and another shortcode that contains the new shortcode string is registered earlier, the earlier shortcode will be used by WordPress.
To make it more clear, here's an example.
{{{
add_shortcode( 'this-is-a-shortcode', 'this_is_a_shortcode' );
add_shortcode( 'this-is-a-shortcode-1', 'this_is_a_shortcode_1' );
function this_is_a_shortcode() {
return 'Shortcode Used';
}
function this_is_a_shortcode_1() {
return 'Shortcode 1 Used';
}
}}}
When i use the above and i call '''[this-is-a-shortcode-1]''' in my content, i get '''Shortcode Used''' instead of '''Shortcode 1 Used'''.
When you change the order of the shortcode registration, WordPress will return '''Shortcode 1 Used''' like it should be.
{{{
add_shortcode( 'this-is-a-shortcode-1', 'this_is_a_shortcode_1' );
add_shortcode( 'this-is-a-shortcode', 'this_is_a_shortcode' );
function this_is_a_shortcode() {
return 'Shortcode Used';
}
function this_is_a_shortcode_1() {
return 'Shortcode 1 Used';
}
}}}
I already searched in the wp-includes/shortcodes.php, but i saw a regex there and thougt... This isn't a fix for me ;)",defect (bug),closed,normal,,Shortcodes,,normal,duplicate,,,