wpautop() - when shortcode attributes are on new lines -breaks args array
- by Luca
I have a custom shortcode tag with a few attributes, and I would like to be able to display its attributes on new lines - to make it more readable to content editors:
[component
attr1 ="value1"
attr2 ="value of the second one"
attr3 ="another"
attr4 ="value"
...
attrN ="valueN"]
The reason behind this requirement is that a few attributes might be quite verbose in content. Unfortunately, wpautop() adds some nasty extra markup that breaks the args array like this (using php print_r($args)):
Array ( [0] => attr1 [1] => ="value1"
/> [3] => attr2 = [4] => "value [5] => of [6] => the [7] => second [8] => one"
/> [10] => "" //...and more like this)
I've tried with the attributes inline:
[component attr1 ="value1" attr2 ="value of the second one" ="value"... attrN ="valueN"]
and the output is as expected:
Array ( [attr1] => value1 [attr2] => value of the second one [attr3] => //...and so on)
is there any way to have the attributes intented and avoid that extra markup that breaks the $args array?