• When i look at the category id in my admin panel i see this:

    https://page/wp-admin/edit-tags.php?action=edit&taxonomy=category&tag_ID=214&post_type=post

    But on the category page the number of the category is 202 not 214. I don’t know why? I use this php code to show the category id number on the page:

    if(is_category() || is_single()){
     $category = end(get_the_category());
     $current =$category->cat_ID;
     $current_name = $category->cat_name;
    }
    echo $current_name . " has id ".$current;

    I don’t know how to fix it… ??

Viewing 1 replies (of 1 total)
  • ‘cat_ID’ contains the term ID. Since a given term can be used in multiple taxonomies, what you need to display is the ‘term_taxonomy_id’.

Viewing 1 replies (of 1 total)
  • The topic ‘Wrong Category ID’ is closed to new replies.