Restrict Content Pro
rcp_user_has_paid_membership()
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 the user has at least one active paid membership (including memberships in a free trial, by default). This is what the deprecated rcp_is_active() calls internally.
Uses RCP_Customer::has_paid_membership() on the customer tied to the user. Cancelled memberships still within their access period can return true if the level is paid and the membership is still active.
Parameters
$user_id (int) – User ID to check. Default: 0 (current logged-in user).
Return values
(bool) – true if the customer has at least one active paid membership (trialing counts as paid); false if there is no customer, only free memberships, or no active paid membership.
Examples
if ( rcp_user_has_paid_membership( get_current_user_id() ) ) {
// Paid or trialing member.
}
if ( ! rcp_user_has_paid_membership( $user_id ) && rcp_user_has_free_membership( $user_id ) ) {
// Active free member only.
}