I'm having some problems with the wp_head hook and the the_content filter in a plugin I'm writing. I have some values stored in an array, and I have written a function that includes checking if one of the keys in that array has a certain value. One function then hooks into wp_head, and another is filtered by the_content except that it doesn't work as it is.
Hopefully the code will help explain more, this is the function that hooks into wp_head:
function my_function() {
if(is_single() && $MyOptions['mykey'] == 'true') {
echo "blah blah" . $MyOptions['myotherkey'] . "blah";
} else {}
}
If I remove the && $MyOptions... and leave it with just is_single, it works fine, except that this time $MyOptions['myotherkey'] isn't echoed, just the blah will show. I know that these keys have values in the array as I have used print_r/echo on the plugin admin page to make sure.
My plugin is kind of dependent on this, and I have no idea why including $MyOptions['mykey'] == 'true' would stop anything, and I've checked other plugins and seen this work.
What is it that I need to do to get this to work?
Thanks in advance, just ask if you need more info.