Restrict Content Pro

rcp_login_form_errors

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

Fires during RCP login processing after built-in username/password checks and before wp_signon(). Use it to add custom validation and error messages.

Add errors with rcp_errors()->add( $code, $message, 'login' ). If any errors occur after this hook, RCP stops and does not attempt to log in.

Parameters

$posted_data (array) – Raw $_POST from the login request (includes rcp_user_login, rcp_user_pass, rcp_user_remember, and related fields).

Examples

function mytheme_rcp_login_form_errors( $posted_data ) {
	if ( empty( $posted_data['rcp_user_login'] ) ) {
		return;
	}

	$user = get_user_by( 'login', sanitize_user( wp_unslash( $posted_data['rcp_user_login'] ) ) );
	if ( $user && ! user_can( $user, 'read' ) ) {
		rcp_errors()->add(
			'login_not_allowed',
			__( 'Your account cannot log in here.', 'mytheme' ),
			'login'
		);
	}
}
add_action( 'rcp_login_form_errors', 'mytheme_rcp_login_form_errors' );

Related: rcp_before_form_errors (runs earlier in the same login handler), RCP Actions List.

Last updated: November 11, 2026
Was this page helpful?
Thanks for the feedback!