WordPress.org

Forums

[resolved] Can a page and a category have the same ID-nr ??? (3 posts)

  1. jetonr
    Member
    Posted 5 years ago #

    My question:
    Can it happen in wordpress that pages and categories have the same id, lets say category id = 1 and page id = 1.
    Are id-s unique to pages, categories, posts?

    In case I want to show both pages and categories in navigation and use the same exclude textfield for both.
    eg code bellow

    <?php
    $exclude_id = get_option('wptube_nav_exclude');
    if (get_option('wptube_cat_menu') == "Categories") {
    wp_list_categories('title_li=0&orderby=name&show_count=0&exclude='.$exclude_id.'');
    } else if (get_option('wptube_cat_menu') == "Pages") {
    wp_list_pages('title_li=0&sort_column=menu_order&exclude='.$exclude_id.'');
    } else { wp_list_categories('title_li=0&orderby=name&show_count=0&exclude='.$exclude_id.'');
    wp_list_pages('title_li=0&sort_column=menu_order&exclude='.$exclude_id.'');	}
    ?>
  2. MichaelH
    Member
    Posted 5 years ago #

    They could have the same id, meaning you can have a page id 3 and a category id 3. That's because they are in different tables.

    How do I determine a Post, Page, Category, Tag, Link, Link Category, or User ID?

    Also note there is:

    $cat_id = get_cat_ID('events');
  3. jetonr
    Member
    Posted 5 years ago #

    Thanks Michael

Topic Closed

This topic has been closed to new replies.

About this Topic