Restrict Content Pro
rcp_get_customer_membership_level_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
Retrieves the customer’s memberships (“active” or “canceled” status) and returns the ID numbers of the associated membership levels.
Parameters
$customer_id (int) – ID of the customer to check. Uses the currently logged-in customer if omitted.
Return values
array – Array of membership level IDs.
Example
Checks to see if the current customer is on membership level #2:
<?php if ( in_array( 2, rcp_get_customer_membership_level_ids() ) ) : ?>
<p>Content inside here would only be visible to active members with a membership level ID of 2.</p>
<?php endif; ?>