Restrict Content Pro
rcp_get_restricted_post_ids()
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 published post IDs that have post-level restriction metadata (paid-only flag, membership level requirements, access level, or legacy level fields). It does not list posts restricted only by taxonomy terms or post-type-wide rules.
Results are cached in the rcp_restricted_post_ids transient for one day. RCP clears that cache (and the term-assignment cache) when posts are saved, trashed, or untrashed.
Parameters
None.
Return values
(array) – Post IDs with post-level restriction meta.
Examples
$restricted_ids = rcp_get_restricted_post_ids();
if ( in_array( get_the_ID(), $restricted_ids, true ) ) {
// This post has metabox-level restrictions stored.
}
Compare with rcp_get_post_ids_assigned_to_restricted_terms() and rcp_is_restricted_content().