Skip to content

Instantly share code, notes, and snippets.

@ideadude
Last active December 23, 2019 09:30
Show Gist options
  • Save ideadude/b62daf1251f7b5ee0c1314cc728af6e9 to your computer and use it in GitHub Desktop.
Save ideadude/b62daf1251f7b5ee0c1314cc728af6e9 to your computer and use it in GitHub Desktop.
Only redirect away from single topic and single reply pages in bbPress when running PMPro and PMPro bbPress
/*
Only redirect away from single topic and single reply pages.
Add this code to a custom plugin.
*/
function wp_maybe_disable_pmprobbp_check_forum() {
global $post;
if(function_exists('bbp_is_topic') && !bbp_is_topic($post->ID) && !bbp_is_reply($post->ID)) {
remove_action( 'template_redirect', 'pmprobbp_check_forum' );
remove_filter( 'pmpro_search_filter_post_types', 'pmprobb_pmpro_search_filter_post_types' );
remove_filter( 'pre_get_posts', 'pmprobb_pre_get_posts' );
}
}
add_action('template_redirect', 'wp_maybe_disable_pmprobbp_check_forum', 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment