Using WordPress ‘admin_email_confirm_form’ PHP action

The admin_email_confirm_form WordPress PHP action fires inside the admin-email-confirm-form form tags, before the hidden fields.

Usage

add_action('admin_email_confirm_form', 'your_custom_function');
function your_custom_function() {
  // your custom code here
}

Parameters

This action does not accept any parameters.

More information

See WordPress Developer Resources: admin_email_confirm_form

Examples

Add a custom input field

This example adds a custom input field to the admin email confirmation form.

add_action('admin_email_confirm_form', 'add_custom_input_field');
function add_custom_input_field() {
  echo '<input type="text" name="custom_field" id="custom_field" value="" placeholder="Enter custom value" />';
}

Display a custom message

This example displays a custom message above the admin email confirmation form.

add_action('admin_email_confirm_form', 'display_custom_message');
function display_custom_message() {
  echo '<p><strong>Note:</strong> Please double-check your email address before submitting.</p>';
}

Add a custom checkbox

This example adds a custom checkbox to the admin email confirmation form.

add_action('admin_email_confirm_form', 'add_custom_checkbox');
function add_custom_checkbox() {
  echo '<label><input type="checkbox" name="agree_terms" id="agree_terms" /> I agree to the terms and conditions.</label>';
}

Display a warning message

This example displays a warning message if the admin email is not from a specific domain.

add_action('admin_email_confirm_form', 'display_warning_message');
function display_warning_message() {
  $admin_email = get_option('admin_email');
  if (!strpos($admin_email, '@yourdomain.com')) {
    echo '<p><strong>Warning:</strong> Please use an email address from yourdomain.com.</p>';
  }
}

Add a custom hidden field

This example adds a custom hidden field to the admin email confirmation form.

add_action('admin_email_confirm_form', 'add_custom_hidden_field');
function add_custom_hidden_field() {
  echo '<input type="hidden" name="custom_hidden_field" id="custom_hidden_field" value="12345" />';
}