/ No 404 because views are all (currently) public $posts_query->bbp_is_404 = false; // Search Page } elseif ( ! is_null( $is_search ) ) { // Check if there are search query args set $search_terms = bbp_get_search_terms(); if ( ! empty( $search_terms ) ) { $posts_query->bbp_search_terms = $search_terms; } // Correct is_home variable $posts_query->is_home = false; // We are in a search query $posts_query->bbp_is_search = true; // No 404 because search is always public $posts_query->bbp_is_404 = false; // Forum/Topic/Reply Edit Page } elseif ( ! is_null( $is_edit ) ) { // Get the post type from the main query loop $post_type = $posts_query->get( 'post_type' ); // Check which post_type we are editing, if any if ( ! empty( $post_type ) ) { switch ( $post_type ) { // We are editing a forum case bbp_get_forum_post_type() : $posts_query->bbp_is_forum_edit = true; $posts_query->bbp_is_edit = true; $posts_query->bbp_is_404 = false; break; // We are editing a topic case bbp_get_topic_post_type() : $posts_query->bbp_is_topic_edit = true; $posts_query->bbp_is_edit = true; $posts_query->bbp_is_404 = false; break; // We are editing a reply case bbp_get_reply_post_type() : $posts_query->bbp_is_reply_edit = true; $posts_query->bbp_is_edit = true; $posts_query->bbp_is_404 = false; break; } // We are editing a topic tag } elseif ( bbp_is_topic_tag() ) { $posts_query->bbp_is_topic_tag_edit = true; $posts_query->bbp_is_edit = true; $posts_query->bbp_is_404 = false; } // We save post revisions on our own remove_action( 'pre_post_update', 'wp_save_post_revision' ); // Topic tag page } elseif ( bbp_is_topic_tag() ) { $posts_query->set( 'bbp_topic_tag', get_query_var( 'term' ) ); $posts_query->set( 'post_type', bbp_get_topic_post_type() ); $posts_query->set( 'posts_per_page', bbp_get_topics_per_page() ); // Do topics on forums root } elseif ( is_post_type_archive( bbp_get_post_types( array( 'has_archive' => true ) ) ) && ( 'topics' === bbp_show_on_root() ) ) { $posts_query->bbp_show_topics_on_root = true; } }