[wp-hackers] is_front_page() after modifying query_posts

Austin Matzko austin at ilfilosofo.com
Fri Mar 11 20:32:01 UTC 2011

On Fri, Mar 11, 2011 at 2:22 PM, Otto <otto at ottodestruct.com> wrote:
> First, in WP, *all* pages are really "index.php". So I assume you
> meant for the root page. http://example.com/ for example.
> Secondly, all the is_whatever() functions are based around the current
> main query. is_archive() will return true on any archive page.
> is_category() returns true on any category archive page. is_page(),
> is_single(), etc., all of them are based on the current query.
> Now, is_front_page() is also based on the current query, as well as
> the front page setting on the Settings page. If you change the query
> to something else, then you're not on the front page anymore.

But unlike is_archive(), is_category(), etc., is_front_page() has no
reasonable scoped use within a custom query.  I may, for example, want
to know whether the current, custom query is for a category or page,
no matter that overall page's query was, but there would never be a
situation in which the custom query result for is_front_page() should
be different from the main query.

So I think it would be reasonable for is_front_page() the function to
be an exception to the general rule, and return the value of the
$wp_the_query method, because it already is exceptional.

More information about the wp-hackers mailing list