WordPress.org

Forums

how to get page_id outside the_loop? (2 posts)

  1. mamulea
    Member
    Posted 6 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. $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

Tags