Forums

[resolved] Exclude Category Slug From wp_list_categories (3 posts)

  1. timsainb
    Member
    Posted 2 years ago #

    So, to get the category id from a category slug, I use:

    <?php
    $idObj = get_category_by_slug('blog');
    $id = $idObj->term_id;
    ?>

    and to exclude a category:
    <?php wp_list_categories('exclude=111'); ?>

    But how do I substitute the variable for 111?

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    <?php wp_list_categories('exclude='.$id); ?>
  3. timsainb
    Member
    Posted 2 years ago #

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.