I think you just forgot to run the shortcodes [foo a="b"]
and [bar a="c"]
through the do_shortcode
filter:
do_shortcode( '[foo a="b"] [bar a="c"]' )
The output of the_content()
is filtered through the do_shortcode
, so you can just add it into your editor instead.
Running your code I get the following output for the $arguments
dump:
array (size=1)
'a' => string 'b' (length=1)
and
array (size=1)
'a' => string 'c' (length=1)
so there’s no '0' => 'bar'
part here.
But you can get the current shortcode tag from the third parameter of the shortcode callback ( I first heard about it in this answer by @toscho )
I just checked the source and if we check out the do_shortcode_tag
function we will find:
// self-closing tag
return $m[1] . call_user_func( $shortcode_tags[$tag], $attr, null, $tag ) . $m[6];
where $tag
is the third parameter containing the shortcode tag.
So in your case you can change your callback to:
function foo( $attributes = array(), $content = null, $tag = '' ) {
echo $tag; // current shortcode tag
echo '<pre>';
var_dump($attributes);
echo '</pre>';
}
to get information about the current shortcode tag.