davesmiths
3/11/2016 - 1:04 PM

Normalise Wordpress shortcode null attributes that come in like [shortcode attr]

Normalise Wordpress shortcode null attributes that come in like [shortcode attr]

<?php
// Normalise attributes that come in like [shortcode attr]
// Strangely when writing this $atts was passed in as '' when there were no attributes, hence the check
if (isset($atts) && $atts != '') {
	foreach ($atts as $v) {
		if (!isset($atts[$v])) {
			$atts[$v] = true;
		}
	}
}
?>