Determine if you are on the Static Posts page in WordPress

When using the Static Home Page option (and thus Static Home Page ) in WordPress, there are ways to check whether you are on the home static page, or the designated posts page.

Static Front Page

// If the current page is the blog posts index,
// but is NOT the site front page
if ( is_home() && is_front_page() ) {
    // do something
}

Static Posts Page

// If the current page is the blog posts index,
// but is NOT the site front page
if ( is_home() && ! is_front_page() ) {
    // do something
}

2 thoughts on “Determine if you are on the Static Posts page in WordPress”

    1. Hi Mark,

      They are extremely similar. The second example has `! is_front_page()`. This is the only difference.

      If you go into Settings > Reading in the WordPress Admin, you’ll see some options for your home page.

      The first is to have your latest posts appear on your home page. For this case, the first example is what you want.

      The second option is to select a specific static page for your Home Page, and another one for your Posts archive page (or Blog). This is where you need the two methods. Example one gets you “Home”, and the second example gets you “Blog”.

Leave a Reply

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