Posted By

raspo on 10/02/10


Tagged

wordpress category name id


Versions (?)

Wordpress: Get category ID from category name


 / Published in: PHP
 

  1. $my_cat_name = "news";
  2.  
  3. $my_cat_id = get_term_by('name', $my_cat_name, 'category')->term_id;
  4.  
  5. echo $my_cat_id; //1

Report this snippet  

You need to login to post a comment.