rcp_restricted_message

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/

Filters the restricted content message that gets shown on a post when the current user doesn't have access.

Parameters:

  • $message (string) - The free or paid restriction message (depending on the post). This will be the message entered in Restrict > Settings > General, or the default such as, "This content is restricted to subscribers".

Example:

This code sets different restriction messages based on whether the content is free or paid:

function ag_rcp_restricted_message( $message ) {
	global $post;

	if ( rcp_is_paid_content( $post->ID ) ) {
		$message = __( 'This requires a paid membership.' );
	} else {
		$message = __( 'This requires a free membership.' );
	}

	return $message;
}
add_filter( 'rcp_restricted_message', 'ag_rcp_restricted_message' );
Powered by Zendesk