[wp-hackers] pre_get_posts problem
angelia at 10sexyapples.com
Fri Jul 23 23:28:30 UTC 2010
This is one of the dangers/pitfalls of using pre_get_posts. It seems to be
recommended often for some reason when dealing with custom post types, but
it is much better to modify the request itself, versus any old get_posts or
The correct filter here would be either 'request' (direct QV access) or
parse_request (whole WP object to play with).
I've been keeping up to date with all things custom post since it's
development began in WP 3.0, and I can confirm that every post
explaining how to use custom post types has given the pre_get_posts
Please excuse my ignorance at not completely understanding the advice
given above, but, could I ask if you would mind giving a clear code
example in this instance of how and where to implement this particular
Is there a way to implement it from the functions file, or should it
be implemented in the author.php template itself, and what is the
correct way to have the author.php file display the regular post type,
select custom post types, and exclude pages?
I have also seen the advice given to use pre_get_posts, but, to make
sure to use (!is_admin) along with it, which according to further
posts in this thread is also inaccurate use of (!is_admin) right?
It would be great to get a simple layman example of how to achieve this~
More information about the wp-hackers