Last active
April 7, 2021 03:45
-
-
Save kimcoleman/65261083d1ae57c8eb261011c9ba9aea to your computer and use it in GitHub Desktop.
Hide the 'gallery' CPT from searches and archives if membership is required to 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
<?php | |
/** | |
* Hide the 'gallery' CPT from searches and archives if membership is required to access. | |
* | |
*/ | |
function hide_gallery_events_filter_post_types( $post_types ) { | |
$post_types[] = 'gallery'; | |
return $post_types; | |
} | |
add_filter( 'pmpro_search_filter_post_types', 'hide_gallery_events_filter_post_types' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This recipe is included in the blog post on "Filter Members-Only CPTs from Searches and Archives" at Paid Memberships Pro here: https://www.paidmembershipspro.com/filter-members-only-cpts-from-searches-and-archives/