Get Home Page ID or Blog Page ID in WordPress

WordPress is number one CMS and have very useful options. You can get Home/Front Page ID by using following code

$frontpage_ID = get_option( 'page_on_front' );

Above Code will return the ID of the Home/Front page we have set for the site, or return 0 if Home/Front page hasn’t been set.

Also you can get the Blog Page ID by using following code

$blogpage_ID = get_option( 'page_for_posts' );

Leave a Reply

Your email address will not be published. Required fields are marked *