is_memberium_protected()

This function takes a post ID (or page Id, or custom post type ID), and returns a boolean true / false depending on whether or not that content is protected.

[php]
function is_memberium_protected( $post_id ) {
$post_id = (int) $post_id;
$post_metas = get_post_meta( $post_id );
$protection_keys = array(
‘_is4wp_access_tags’,
‘_is4wp_anonymous_only’,
‘_is4wp_any_loggedin_user’,
‘_is4wp_any_membership’,
‘_is4wp_contact_ids’,
‘_is4wp_membership_levels’,
);
foreach( $post_metas as $key => $value ) {
if ( in_array( $key, $protection_keys ) ) {
$value = implode( ”, $value );
if ( ! empty( $value ) ) {
return true;
}
}
}
return false;
}

[/php]

  • Was this Helpful?
  • YesNo
9 ways to add more value to your membership site

Table of Contents

Keep Reading

confirmation link memberium

Guide to Using Confirmation Link in Memberium

You must have seen confirmation links in emails, and its like a compulsory step to proceed forward when creating an account on the site. In this small guide, you’ll learn the benefits of using confirmation link and how you can use them in your campaign. Let’s get started!

Read More »

Want to get some fresh ideas on how you can improve your membership site or course?

Download our free ebook!

Book a Call

Welcome to Memberium!

We are very excited for you to be part of our family. 

We would love to answer any questions that you have!

Please choose the best time for you to get in a call with us. 

For Technical Support, you can contact us at https://keap.memberium.com/support/ or Email us at support@memberium.com.