Ready to get started?Download WordPress


how to get page_id outside the_loop? (2 posts)

  1. mamulea
    Posted 5 years ago #

    Hello. I need to know how can I automatically retrieve outside the_loop a page ID when I know its name/slug. If you want, I need a similar function as get_cat_id(), related to static pages. 10x in advance.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    $page = get_page_by_title('Title of the Page');
    echo $page->ID;

Topic Closed

This topic has been closed to new replies.

About this Topic