Restrict Content Pro
rcp_before_password_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 at the start of change-password processing in rcp_change_password(), after the nonce is verified and before RCP checks empty or mismatched passwords.
Use it for early validation of the change-password/reset-completion form ([password_form] shortcode and related flows).
Parameters
$posted_data (array) – Raw $_POST from the password change request (includes rcp_user_pass, rcp_user_pass_confirm, rcp_password_nonce, and related fields).
Examples
function mytheme_rcp_before_password_form_errors( $posted_data ) {
if ( ! empty( $posted_data['rcp_user_pass'] ) && strlen( $posted_data['rcp_user_pass'] ) < 12 ) {
rcp_errors()->add(
'password_too_short',
__( 'Password must be at least 12 characters.', 'mytheme' ),
'password'
);
}
}
add_action( 'rcp_before_password_form_errors', 'mytheme_rcp_before_password_form_errors' );
Related: rcp_password_form_errors, rcp_before_password_form.