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:

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.

Last updated: October 7, 2026
Was this page helpful?
Thanks for the feedback!