Getting category Id by slug
-
Hi all,
I was trying to implement this bit of code here which I borrowed from the following link.
However when I tried to echo out the id, nothing came out. Any ideas?
Here’s the code
<?php $pageslug = $post->post_name; echo $pageslug; $category = get_category_by_slug('$pageslug'); $the_id = '$category->cat_ID'; echo $the_id; ?>
Any ideas?
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Getting category Id by slug’ is closed to new replies.