Created
July 3, 2015 21:23
-
-
Save strangerstudios/cc30ee167aa7e3edeaa7 to your computer and use it in GitHub Desktop.
Hide bbPress forums protected with PMPro and PMPro bbPress from users who don't have access.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
By default pmpro-bbpress will hide topics and replies within a forum, but | |
will still show the member forums in the forums list. | |
You can use this code to hide forums from that list. | |
Note that you should tweak the post_type array there | |
if you are already using the "Filter Searches and Archives" option | |
to hide other post types. | |
*/ | |
//function to tell PMPro to hide forums or also hide forums in searches | |
function my_pmpro_search_filter_post_types($post_types) | |
{ | |
//$post_types = array("page", "post", "forums"); //use this one if you want to keep pages and posts out of searches also | |
$post_types = array("forum"); | |
return $post_types; | |
} | |
add_filter('pmpro_search_filter_post_types', 'my_pmpro_search_filter_post_types'); | |
//this line overrides the "Filter searches and archives?" advanced setting to turn it on | |
add_filter( 'pre_get_posts', 'pmpro_search_filter' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment