Posted By

S_Park on 07/30/10


Tagged

wordpress category


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

osirisinternet


Wordpress: Get current category ID and name


 / Published in: PHP
 

  1. <?php if (is_category()) {
  2. global $wp_query;
  3. $cat_obj = $wp_query->get_queried_object();
  4. echo $cat_obj->name . " has id ". $cat_obj->term_id;
  5. } ?>

Report this snippet  

You need to login to post a comment.