[wp-hackers] pre_get_posts problem
Angelia Baladon
angelia at 10sexyapples.com
Sat Jul 31 06:42:01 UTC 2010
Hi all,
Well, I'm still at it trying to figure out what to do to get my custom post
types in the loop for my author.php file. Ironically, I think I'm beginning
to understand why everyone is using the pre_get_posts solution ... ? I got
this bit from Andrew ... thanks Andrew! but, unfortunately, I tested it and
it didn't return any results. Does anyone else have anything to add that
might help here? There are literally hundreds of sites out there
recommending the pre_get_posts solution to this, so, it anyone can help sort
this out, I'll be sure to go viral with the answer ... if only *sigh*. It's
over my head, so, all I can do is keep begging ;-)
Here's the code from Andrew:
<code>
function my_request_cpt_author( $query_vars ) {
if ( is_author() )
$query_vars['post_type'] = array( 'post', 'my_post_type' );
return $query_vars;
}
add_filter( 'request', 'my_request_cpt_author' );
</code>
It's a whole new month, so, how 'bout it?
Angie
More information about the wp-hackers
mailing list