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

  1. jetonr
    Posted 6 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

    $exclude_id = get_option('wptube_nav_exclude');
    if (get_option('wptube_cat_menu') == "Categories") {
    } else if (get_option('wptube_cat_menu') == "Pages") {
    } 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
    Posted 6 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
    Posted 6 years ago #

    Thanks Michael

Topic Closed

This topic has been closed to new replies.

About this Topic