rcp_restricted_message

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' );