[wp-hackers] bug in is_home in query filters for custom post landing pages?
Michael Pretty
mpretty at voceconnect.com
Mon Jun 14 19:28:06 UTC 2010
I don't know if its a bug as much as it is something that was never
really discussed. I think a lot of us that have been working with
custom post types for a while now, knew that this was the case, but have
never discussed if the is_home() functionality should change or if an
alternate function should be made as a work around. Personally, I have
been testing against is_home() and get_query_var('post_type').
Michael Pretty
prettyboymp
On 6/14/10 3:19 PM, Simon Blackbourn wrote:
> i've just installed RC3 and it seems that all the post query filters
> (posts_join, posts_where, posts_orderby& posts_fields) are seeing is_home()
> as true for custom post type landing pages, even when they're not the home
> page.
>
> in my case, i have a custom post type called "member", the main landing page
> is mydomain.com/members (which is not the home page of my site), but the
> following filter runs on that page:
>
> add_filter( 'posts_orderby', 'my_members_orderby' );
>
> function my_members_orderby( $sql ) {
>
> global $wpdb, $wp_query;
>
> if ( is_home() ) {
> return $wpdb->prefix . "posts.post_title ASC";
> }
>
> return $sql;
>
> }
>
> is this a bug or is it correct behaviour - are the landing pages for custom
> post types considered a 'home' page? if so, seems a bit odd to me.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list