Home / Archive / MemberPress: Exclude Posts, Pages, Categories, or Tags from PayWall
Duplicate Snippet

Embed Snippet on Your Site

MemberPress: Exclude Posts, Pages, Categories, or Tags from PayWall

Exclude specific posts, pages, categories, or tags from being viewed with the PayWall free views.

Code Preview
php
<?php
//Posts
function mepr_cust_pw_exclude_posts_pages( $exclude, $post ) {
  $exclude[] = 1234; //Change this to the post or page id you want to exclude.
  $exclude[] = 64; //Change this to the post or page id you want to exclude.
  $exclude[] = 107; //Change this to the post or page id you want to exclude. Copy this line for additional posts or pages;
  
  return $exclude;
}
add_filter( 'mepr-paywall-excluded-posts', 'mepr_cust_pw_exclude_posts_pages', 10, 2 );
//Categories
function mepr_cust_pw_exclude_categories( $exclude, $post ) {
  $exclude[] = 'category_slug'; //Change this to the slug of the category you want to exclude. Copy this line for additional categories.
  
  return $exclude;
}
add_filter( 'mepr-paywall-excluded-category-slugs', 'mepr_cust_pw_exclude_categories', 10, 2 );
//Tags
function mepr_cust_pw_exclude_tags( $exclude, $post ) {
  $exclude[] = 'tag_slug'; //Change this to the slug of the tag you want to exclude. Copy this line for additional tags.
  
  return $exclude;
}
add_filter( 'mepr-paywall-excluded-tag-slugs', 'mepr_cust_pw_exclude_tags', 10, 2 );

Comments

Add a Comment