When I create shortcodes that accept html tags i only take the tag name, meaning that if the tag is <h3>
then i ask the user to enter h3
and i add the <
, </
and >
in the shortcode handler ex:
extract( shortcode_atts( array(
'count' => -1,
'category_name' => '',
'q_tag' => 'h3',
'orderby' => 'date', //'none','ID','author','title','name','date','modified','parent','rand','menu_order'
'order' => 'ASC', //'DESC'
), $atts, 'myfaq' ) );
$q_before="<".$q_tag.'>';
$q_after="</".$q_tag.'>';
I’m not saying that its best practice but at least I’m only asking the user to provide on tag name instead of opening and closing tags and i don’t need any extra conversions using html_entity_decode
.