Viewing 2 replies - 1 through 2 (of 2 total)
  • Is this resolved? (Topic is currently set to resolved.)

    Anyway, this bit of code works on category queries:

    <?php
    $cat_object = $wp_query->get_queried_object();
    $cat_parent = $cat_object->category_parent;
    ?>

    $cat_parent will hold the ID for the parent category of the ‘current’ one.

    Thread Starter storyday

    (@storyday)

    thanks,because of the earthquake of TW,I can hardly visit the site!so late reply!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how can I get parent cat id from current cat’ is closed to new replies.