1. Home
  2. Knowledge Base
  3. WC Vendors Memberships
  4. How To
  5. How to Exclude Membership from Displaying?
  1. Home
  2. Knowledge Base
  3. WC Vendors Memberships
  4. How to Exclude Membership from Displaying?

How to Exclude Membership from Displaying?

There might be a time when you need to exclude a membership from displaying on the vendor dashboard. The following snippet will allow you to exclude one or more membership products from the list. 

The following code would go in your themes functions.php.

<?php 
add_filter( 'wcv_membership_product_query_args', 'exclude_membership_plan' );
 function exclude_membership_plan( $args ){ 
	$current_page_id = get_the_ID();
  
  // If this is not the pro dashboard do nothing
	if ( ! wcv_is_dashboard_page( $current_page_id ) ){ 
		return $args;
	}
	// This should be the membership product IDs in this example the product ID is 471
	$plans = array( 471 );
	$args['post__not_in'] = $plans;
	return $args;
 }
Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support