This question already has an answer here:

I've set a global variable in functions.php like so:

$cat_args = array('cat1', 'cat2', 'cat3');

and tried to use it in a template file:

global $cat_args;
if is_cat($args):
//do stuff

The conditional returned false. If I echo $cat_args I get an array. Is there an extra step to passing it to the conditional / is what I'm trying to do possible? Thanks!

marked as duplicate by s_ha_dum May 7 '14 at 23:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • You did not set a global, and your syntax is wrong on the first line of the second code block, and it is a duplicate of : wordpress.stackexchange.com/a/81584/21376 – s_ha_dum May 7 '14 at 23:47
  • aside form the syntax error you pointed out, the code works. – psorensen May 8 '14 at 0:25