Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a script that needs to know if the site is using a static home page. In other words, at "Settings > Reading > Front Page Displays > a Static Page __"

Is there a a get_option() or method call that can be used to determine this?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted
get_option( 'page_on_front' );

If this value is not 0, there is a static page.

Additional note from Johannes Pille:

get_option( 'show_on_front' );

… returns post or page. But be aware of custom post types as front page.

A good way to find common options is to visit the (hidden) page wp-admin/options.php.

share|improve this answer
    
Alternatively, get_option( 'show_on_front' ); returns either posts or page (string). Actually, I am not certain, if 'page_on_front' gets set back to 0 if it had been set before and 'show_on_front' is reverted back to posts later. Are you? –  Johannes Pille Jun 1 '12 at 21:02
    
Yes, I can confirm that 'page_on_front' does get set back to 0 when changed and 'show_on_front' also gets changed back to posts as well. –  N2Mystic Jun 1 '12 at 22:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.