rcp_get_membership_cancel_url()

Note: This is part of the developer docs and is considered custom code.
Unfortunately, we cannot provide support for custom code at this time as we do not have the additional resources that would be necessary to provide support for custom code. 

If you need assistance with this, please reach out to our list of consultants for further assistance:
https://codeable.io/developers/restrict-content-pro/

Returns the membership cancellation URL for a given membership. It's a good idea to pair this with RCP_Membership-can_cancel().

Parameters:

  • $membership_id - ID of the membership.

Return values:

  • (string) Cancellation URL. An empty string may be returned if the user does not have a recurring membership.

Example usage:

$membership = rcp_get_membership( 1 );
if ( $membership->can_cancel() ) {
    printf( __( '<a href="%s">Click here to cancel your membership</a>', 'rcp' ), esc_url( rcp_get_membership_cancel_url( $membership->get_id() ) ) );
}
Powered by Zendesk