Restrict Content Pro
RCP_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
The RCP_Membership class was released in version 3.0. It represents one membership record for a customer (level, status, dates, gateway IDs, and billing amounts) and provides helper methods for reading and updating that record.
Getting a membership
The main way to load a membership is rcp_get_membership() when you know the membership ID:
$membership = rcp_get_membership( 123 );
If rcp_get_membership() cannot find a record, it returns false.
These also return RCP_Membership objects:
rcp_get_memberships()RCP_Customer::get_memberships() (see Retrieving customer data)
Do not instantiate RCP_Membership manually.
Retrieving membership data
Once you have an RCP_Membership object, use these methods to read stored data.
Identity and relationships
get_id() — Membership ID.get_customer_id() — ID of the RCP_Customer record this membership belongs to.get_customer() —ÂRCP_Customer object for this membership.get_user_id() — WordPress user ID for the customer (may be backfilled from the customer record).get_object_id() — Linked object ID; for standard memberships this is the membership level ID.get_object_type() — Object type slug (typicallyÂmembership).get_membership_level_name() — Display name of the membership level, orÂfalse if the level cannot be loaded.
Amounts and currency
get_currency() — Currency code used for this membership (for exampleÂUSD).get_initial_amount( $formatted = false ) — Amount charged on initial signup. WithÂ$formatted set toÂtrue, the value includes the currency symbol.get_recurring_amount( $formatted = false ) — Renewal amount. WithÂ$formatted set toÂtrue, the value includes the currency symbol.get_formatted_billing_cycle() — Human-readable billing summary (for example initial plus recurring interval,ÂFree, or a lifetime one-time price).
Status and dates
get_status() — Status slug:Âactive,Âcancelled,Âexpired, orÂpending.get_expiration_date( $formatted = true ) — Expiration or next renewal date. WithÂ$formatted set toÂtrue, the date uses your site’s date format from Settings → General. WithÂ$formatted set toÂfalse, the value is MySQL datetime format, or the stringÂnone for lifetime / no expiration.get_expiration_time() — Expiration as a Unix timestamp, orÂfalse when there is no expiration.get_created_date( $formatted = true ) — Date the membership record was created.get_activated_date() — Date payment was confirmed and the membership first became active (MySQL format).get_trial_end_date() — Trial end date in MySQL format, or empty if there is no trial.get_cancellation_date( $formatted = true ) — Date the membership was cancelled, if applicable.get_renewed_date( $formatted = true ) — Date of the last renewal.get_times_billed() — Number of times this membership has been billed (includes the first payment).get_maximum_renewals() — Maximum renewals for a payment plan (0 means unlimited).
Gateway and subscription key
get_gateway() — Payment gateway slug used for billing (may be inferred from gateway IDs when empty).get_gateway_customer_id() — Gateway customer or profile ID (for example StripeÂcus_…). Not all gateways use this.get_gateway_subscription_id() — Gateway subscription ID (for example StripeÂsub_…).get_subscription_key() — Unique subscription key for this membership.
Upgrade history
get_upgraded_from() — If this membership was created by upgrading, the ID of the previous membership; otherwiseÂ0.
Notes, signup method, payments, and card
get_notes() — Admin notes stored on this membership.get_signup_method() — How the membership was created:Âlive (registration form),Âmanual (admin), orÂimported (CSV).get_payments( $args = array() ) — Payments for this membership. OptionalÂ$args override the default query (membership ID is set automatically).get_card_details() — Array of card-on-file details from the gateway (gateways populate this via theÂrcp_membership_get_card_details filter). Structure depends on the gateway; Stripe may return keys such asÂname,Âtype,Âlast4,Âexp_month, andÂexp_year under aÂstripe key.get_payment_plan_completed_date() — When the payment-plan completion routine ran, or empty if not complete.
Examples — formatted amounts and expiration
$membership = rcp_get_membership( 1 );
echo $membership->get_initial_amount( false );
echo $membership->get_initial_amount( true );
echo $membership->get_expiration_date( true );
echo $membership->get_expiration_date( false );
Other helper methods
These methods update membership data or perform membership actions. They do not replace checkout or registration unless you are building custom admin or automation.
Status, dates, and billing flags
set_status( $new_status ) — Updates membership status. Returns whether the update succeeded.set_expiration_date( $new_date = '' ) — Sets expiration or next renewal date (MySQL datetime).calculate_expiration( $from_today = false, $trial = false ) — Calculates a new expiration date (renewals, trials, level duration).set_renewed_date( $date = '' ) — Sets last renewed date; defaults to current time if omitted.set_object_id( $object_id ) — Sets the membership level ID (object_id).is_trialing() —Âtrue during an active trial.is_active() —Âtrue if the membership is not disabled, not expired, and status isÂactive orÂcancelled (cancelled members keep access until end of term). Filter:Ârcp_membership_is_active.is_paid( $include_trial = true ) —Âtrue if the membership is paid; trials count as paid whenÂ$include_trial isÂtrue.is_expired() —Âtrue if the expiration date is in the past. May set status toÂexpired when appropriate (pending is excluded).is_recurring() —Âtrue if auto-renew is enabled in RCP.set_recurring( $is_recurring = true ) — Updates the auto-renew flag only; does not create or cancel gateway subscriptions.
Auto-renew toggling (3.4+)
can_toggle_auto_renew() —Âtrue when site settings allow customer choice, the gateway supports off-site subscription creation, and this membership has a gateway customer ID and recurring price.toggle_auto_renew_off() — Cancels recurring billing at the gateway and clears auto-renew / gateway subscription ID in RCP. Does not change membership status by default. ReturnsÂtrue orÂWP_Error.toggle_auto_renew_on() — Creates a gateway subscription and enables auto-renew. ReturnsÂtrue orÂWP_Error.
Gateway and subscription key
set_gateway_customer_id( $customer_id = '' ) — Sets the gateway customer ID.set_gateway_subscription_id( $subscription_id = '' ) — Sets the gateway subscription ID.set_subscription_key( $subscription_key = '' ) — Sets the subscription key; generates one if empty.
Upgrade history
was_upgrade() —Âtrue if this membership was upgraded from another (get_upgraded_from() is non-empty).was_upgraded() — If this membership was upgraded to a new membership, returns that membership ID; otherwiseÂfalse.
Activation, renewal, and upgrades
activate() — First-time activation: activated date, active status, level user role, welcome email hooks. Prefer overÂset_status( 'active' ) for new activations.can_renew() —Âtrue if manual renewal is allowed. Filter:Ârcp_membership_can_renew.renew( $recurring = false, $status = 'active', $expiration = '' ) — Extends expiration and updates status/recurring after payment is handled. LeaveÂ$expiration empty to calculate automatically.upgrade_possible() —Âtrue if the membership can be upgraded to another level.has_upgrade_path() —Âtrue if at least one other active level exists besides the current one.get_upgrade_paths() — Array ofÂMembership_Level objects available for upgrade. Filter:Ârcp_get_membership_upgrade_paths.
Payment plans
has_payment_plan() —Âtrue whenÂget_maximum_renewals() is greater than zero.at_maximum_renewals() —Âtrue when the plan has reached its renewal limit.set_payment_plan_completed_date( $date = '' ) — Records payment plan completion date.is_payment_plan_complete() —Âtrue if a completion date is stored.complete_payment_plan() — Runs after-final-payment actions per level settings.
Disable, enable, cancel, expire
is_disabled() —Âtrue if the membership was soft-deleted in admin.disable() — Soft-delete: stop billing when possible, revoke access, hide from customer, remove level role.enable() — Re-enable a disabled membership; restores role when still active.cancel() — Sets status toÂcancelled, runs cancellation hooks and email. Does not cancel gateway billing by itself.can_cancel() —Âtrue if on-site cancellation of a live recurring subscription is supported.cancel_payment_profile( $set_status = true ) — Cancels recurring billing at the gateway. WhenÂ$set_status isÂtrue, also runsÂcancel().expire() — Expires the membership and revokes restricted content access.
Notes, access, proration, and billing
add_note( $note = '' ) — Appends an admin note on this membership.can_access( $post_id = 0 ) —Âtrue if this membership grants access to the post.has_access_level( $access_level_needed = 0 ) —Âtrue if the membership level meets or exceeds the required access level.get_prorate_credit_amount() — Unused-time credit when upgrading or changing levels. Filter:Ârcp_membership_get_prorate_credit.can_update_billing_card() —Âtrue if the gateway supports card updates and auto-renew applies.increment_times_billed() — Increments billed count; may runÂcomplete_payment_plan() when limits are met.
Gateway subscription management (3.5+)
can_change_gateway_price() —Âtrue if the gateway supports price changes and this membership has an active recurring gateway subscription.change_gateway_price( $new_price ) — Updates recurring price at the gateway andÂrecurring_amount on success.can_create_gateway_subscription() —Âtrue if the gateway supports creating a subscription outside registration and none exists yet.create_gateway_subscription( $charge_now = false ) — Creates a gateway subscription ($charge_now controls immediate charge vs waiting until expiration).can_change_next_bill_date() —Âtrue if auto-renew is on, a gateway subscription ID exists, and the gateway supports renewal date changes.change_next_bill_date( $new_date ) — Updates next bill date at the gateway ($new_date in MySQL format).
For user-centric helpers (multiple memberships, trials across levels, User Switching URLs), see the deprecated RCP_Member class or RCP_Customer.