Strange output for get_cat_id()
-
I’m working on a template for which I’m trying to get category IDs, and in testing, I put the following piece of code in the template:
<?php $cat_title = single_cat_title(); $category_id = get_cat_id($cat_title); echo $category_id; ?>
What gets returned is, for example, Booklets(), where Booklets is the single_cat_title. If I echo $cat_title, I get the expected result: Booklets.
I am admittedly not very proficient at php, so I can’t see where the problem is.
Help appreciated.
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Strange output for get_cat_id()’ is closed to new replies.