Restrict Content Pro
rcp_is_trialing()
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 membership currently in a trial period. Loads the RCP_Customer for the user and checks each membership with RCP_Membership::is_trialing().
Parameters
$user_id (int) – User ID. Default: 0 (current logged-in user).
Return values
(bool) – true if any membership is trialing; false if there is no customer or no trialing membership.
Examples
if ( rcp_is_trialing() ) {
// Current user is in a trial.
}
$membership = rcp_get_membership( 456 );
if ( $membership && $membership->is_trialing() ) {
// Membership #456 is trialing.
}