Hello and thank you for being there.
I run into this problem sometimes. Usually I want to use the content of a variable as the property of a WP function.
For example, this code:
$aCategory = single_cat_title(); $theId = get_cat_id('My Category'); echo "Category: " . $aCategory . " - " . $theId;
shows this: "Category: My Category - 3"
But this other code, which is supposed to be the same but using a variable for the property of the get_cat_id() function, shows everything except the Category ID.
$aCategory = single_cat_title(); $theId = get_cat_id($aCategory); //here is the only changed I did echo "Category: " . $aCategory . " - " . $theId;
It shows: "Category: My Category - 0"
I have tried
And both give me 0, instead of the category id.
Thanks a lot!