Restrict Content Pro
rcp_is_restricted_content()
Coming soon: Restrict Content Pro is becoming Kadence Memberships. You may see both names used while we update the product, documentation, and customer experience.
Note: This content is provided as a resource within our developer documentation. Because custom code requires highly specific implementation, we encourage you to work with a qualified developer if you need guidance. You can find our recommended consultants here: https://codeable.io/developers/restrict-content-pro
Returns whether a post has any RCP restriction configured—post-level rules, post-type rules, or restrictions inherited from a taxonomy term. It does not check whether the current user is allowed to view the post; use rcp_user_can_access() for that.
Parameters
$post_id (int) – Post ID. Must be a numeric ID; empty or invalid IDs return false.
Return values
(bool) – true if the post is restricted in any way; otherwise false.
Examples
if ( rcp_is_restricted_content( get_the_ID() ) ) {
// This post has RCP restrictions configured.
}
if ( ! rcp_is_restricted_content( $post_id ) ) {
// No RCP restrictions on this post.
}
Related:Â rcp_has_post_restrictions | rcp_get_post_restrictions()