Posted By

athanassiadis on 05/11/11


Tagged

wordpress category function


Versions (?)

Get category id by name


 / Published in: PHP
 

How to get a category id from the name of the category

  1. function get_category_id($cat_name){
  2. $term = get_term_by('name', $cat_name, 'category');
  3. return $term->term_id;
  4. }

Report this snippet  

You need to login to post a comment.