I’m trying to change a value in a $key => $value pair but I can’t seem to get it working.
$atts = shortcode_atts( array(
"type" => FALSE,
"size" => FALSE
), $atts );
print_r($atts);
Output:
Array
(
[type] => default
[size] => default
)
if ( $atts['size'] == 'default' ) {
$atts['size'] == false;
}
print_r($atts);
Output:
Array
(
[type] => default
[size] => default
)
Basically, what I want to do is, if “size” is “default”, then reset the value to false or an empty string. What am I doing wrong?
You didn’t assigned the variable! See:
You have to remove one
=
so it looks like this:Also i would use
var_dump
here, because if you assign false and you useprint_r
the output would be:With
var_dump
you see it better: