Skip to content

Instantly share code, notes, and snippets.

@kimcoleman
Last active April 7, 2021 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimcoleman/65261083d1ae57c8eb261011c9ba9aea to your computer and use it in GitHub Desktop.
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.
<?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' );
@laurenhagan0306
Copy link

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment