Restrict Content Pro
rcp_user_can_access_term()
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 user meets the restrictions on a taxonomy term (category, tag, or other registered taxonomy). Reads rules with rcp_get_term_restrictions(). Administrators (manage_options) always get access. Unrestricted terms return true.
Parameters
$user_id (int) – User ID to check.
$term_id (int) – Term ID to check.
Return values
(bool) – true if the user may access content tied to this term, or the term has no restrictions; false if the user fails paid-only, access level, or membership level requirements, or has no customer record when restrictions apply.
Examples
$term_id = get_queried_object_id();
if ( rcp_user_can_access_term( get_current_user_id(), $term_id ) ) {
// User can access this category archive.
}
See rcp_user_can_access() for per-post checks.