Wordpress - How to get post id of static front page?

WordPress has a few useful options. You can get the homepage ID by using the following:

$frontpage_id = get_option( 'page_on_front' );

or the blog ID by using:

$blog_id = get_option( 'page_for_posts' );

Here's a list of many useful get_option parameters.


You should be able to use $front_page_id = get_option( 'page_on_front' );

It'll return the ID of the page you're using as your site's front page, or 0 if it hasn't been set.

Codex: get_option()