[wp-hackers] pre_get_posts problem

Angelia Baladon angelia at 10sexyapples.com
Mon Aug 2 19:33:09 UTC 2010

Oh happy day ( oh happy day ) ... Oh happy da-ay!

Mike, that code worked ( once I removed nav_menu_item from the array ...
which I'm sure is what you intended )

add_filter( 'parse_query', 'my_parse_query' );
function my_parse_query( $query ) {
       $q = $query->query;
       $is_menu = (isset($q['post_type']) &&
       if (!$is_menu && ((is_author() && isset($q['author_name']) ||
(is_search() && isset($q['s']))))) {
               $query->query_vars['post_type'] = array( 'post', 'lesson',
'howto', 'workshop', 'attachment' );

And although I don't have a deep enough understanding of all of the internal
functions yet myself, I do understand completely what is happening here, so
I will be able to prevent anything setting something that would interfere.

Thanks so much for working this out Mike!!! Breathing much easier today~


More information about the wp-hackers mailing list