• I fiddling around with my template, and I have a rather stupid problem. When I use the ‘<?php the_category_ID() ?>’ tag in the index.php file, the only number I get is 0. I was exspecting to get 1, 2, 3, etc for the category number … any hints on how to fix it?
    (http://gnomishinventions.com/walmart)

Viewing 2 replies - 1 through 2 (of 2 total)
  • Because of support for multiple categories, the_category_ID tag has been deprecated and will not work for post 1.0 builds. I looked in the Wiki and it doesn’t give an alternative (in fact, it still thinks the_category_ID exists; so much for being more up-to-date than the official docs) but you could try <?php $categories = get_the_category(); echo $categories[0]->category_id; ?>.
    If that doesn’t work you may have to rethink whether you really need the category ID. Sometimes when you get a new feature you have to lose an old one, and more people seem to use multiple cats than the cat ID so we can’t complain.

    Thread Starter quayso

    (@quayso)

    Much thanks, that worked beautifully.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘category id’ is closed to new replies.