Currently using bbPress as a forum. But now I have some conflict and archive post page is displaying instead of forum? How should I proceed? Any ideas?


Actually found the causing problem. It is that function that seems is interupting somehow with my forums. The function is for displaying custom post type in author archive page. Still don't have a solution for that problem.

function namespace_add_custom_types( $query ) {
  if( is_archive() && empty( $query->query_vars['suppress_filters'] ) ) {
    $query->set( 'post_type', array(
     'post', 'vehicles'
     return $query;
add_filter( 'pre_get_posts', 'namespace_add_custom_types' );
  • Currently don't have a solution. I'm asking how this function interupts my forums and a idea how to fix it. Thanks. – worldwildwebdev Jul 24 '14 at 8:48
  • I edited the post again. I found the problem, but didn't found a solution. Thanks. – worldwildwebdev Jul 24 '14 at 9:01

As your pre_get_posts function stands, you'll have that conflict as you are using pre_get_posts very carelessly.

pre_get_posts modifies the query variable object before the main query AND WP_Query is executed. So any changes in your function will influence both the main query and any custom query that uses WP_Query. That is why everything is haywire in your forum pages as well, as you are adding these changes to your forum as well

Secondly, when working with any type of archive query (is_archive(), is_category() etc), any changes made with pre_get_posts will also affect the back end

So, your solution would be to run pre_get_posts only on the main query (is_main_query()), and also just in the front end (!is_admin())

Something like this will do

if( !is_admin() && $query->is_main_query() && $query->is_archive() );


I'm not going to change my code above. Only realized your code is for author page. Then you should be using is_author(), not is_archive()

  • Please see my edit as well. Misread author for archive – Pieter Goosen Jul 24 '14 at 9:33
  • That did the job! Thanks a lot! I'll further learn more about queries. Not an easy job. – worldwildwebdev Jul 24 '14 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.