Restrict Content Pro
rcp_before_register_form_fields
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 inside the registration form template (register-common.php), before the default username, email, name, and password fields.
It runs only when the visitor is not logged in. Logged-in users renewing or upgrading skip this block. Output HTML here (inside the <form>) so fields submit with registration. Validate submitted values on rcp_form_errors with error group 'register'.
For markup above or below the entire form wrapper, use rcp_before_register_form or rcp_after_register_form instead.
Parameters
None.
Examples
function mytheme_rcp_before_register_form_fields() {
?>
<p id="rcp_company_wrap">
<label for="rcp_company"><? esc_html_e( 'Company', 'mytheme' ); ?></label>
<input type="text" name="rcp_company" id="rcp_company" class="required" value="<?php echo isset( $_POST['rcp_company'] ) ? esc_attr( wp_unslash( $_POST['rcp_company'] ) ) : ''; ?>" />
</p>
<?php
}
add_action( 'rcp_before_register_form_fields', 'mytheme_rcp_before_register_form_fields' );
Pair validation with rcp_form_errors and saving logic as in Creating Custom Registration Fields.
Related: rcp_after_register_form_fields, rcp_after_password_registration_field.