[wp-hackers] is_front_page() after modifying query_posts

Mike Schinkel mikeschinkel at newclarity.net
Mon Mar 14 16:20:56 UTC 2011


On Mar 14, 2011, at 12:04 PM, Jeremy Clarke <jer at simianuprising.com> wrote:
> Sidenote: "Root page" is a MUCH better label than "front page" which is not
> very clear, especially in relation to "home" which is semantically
> equivalent to "front page" but in this case indicates an important
> difference.
> 
> How many puppies would need to be sacrificed to get these two confusing
> functions to be deprecated in favor of is_root() and is_blog(). is_blog()
> would tell you if you are on the 'posts archive', whether it is on the root
> or in a 'page'.

+1!

> If what you want is to modify the main query then query_posts is
> terrible because it lets the main query still run, then just throws away the
> original results in favor of the new ones. This means a very wasteful posts
> query (in my case doing it that way was really hurting database performance
> till i fixed it).

Yes! Would also be nice if we could even bypass the default query if we need to.  I requested as much on trac a few years ago but with no takers.

> So far the biggest issue I had with this was being able to identify only the
> main query. 

Denis de Bernardy recommended $wp_query===$wp_the_query to me, which seems to work well.

-Mike


More information about the wp-hackers mailing list