[wp-hackers] pre_get_posts problem

Angelia Baladon angelia at 10sexyapples.com
Wed Jul 21 04:57:50 UTC 2010


Howdy all,

I'm running a pre_get_posts filter on is_author() in order to include my
custom post types when author.php is called.

If I don't include nav_menu_item in the query set, the primary menu (
basically the default twenty ten nav ) disappears. This makes sense.

But, if I DO include nav_menu_item in the query set, I get nav_menu_item/s
listed in the loop.

I could have a bug related to some of my attempts to get the link object
type, but, wanted to know if anyone else has experienced this before I wipe
the database.

If anyone is using the new navigation and could confirm if it's just me
that'd be swell:

add_filter( 'pre_get_posts', 'custom_posts' );

function custom_posts( $query ) {

    if ( is_author() )
        $query->set( 'post_type', array( 'post', 'nav_menu_item', 'lesson',
'howto', 'workshop', 'attachment' ) );

    return $query;
}

replace my custom post types with yours and check your author page.

Over and out~
Angie


More information about the wp-hackers mailing list