settings_fields

Output nonce, action, and option_page fields for a settings page.

Description

settings_fields( (string) $option_group ); 

Parameters (1)

0. $option_group (string)
A settings group name. This should match the group name used in register_setting().

Usage

  1. if ( !function_exists( 'settings_fields' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/plugin.php'; 
  3.  
  4. // A settings group name. This should match the group name used in register_setting(). 
  5. $option_group = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = settings_fields($option_group); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/plugin.php  
  1. function settings_fields($option_group) { 
  2. echo "<input type='hidden' name='option_page' value='" . esc_attr($option_group) . "' />"; 
  3. echo '<input type="hidden" name="action" value="update" />'; 
  4. wp_nonce_field("$option_group-options");