Via the Developer Reference (not the Codex)
Output nonce, action, and option_page fields for a settings page.
Here’s the source code for it
function settings_fields($option_group) {
echo "<input type="hidden" name="option_page" value="" . esc_attr($option_group) . "" />";
echo '<input type="hidden" name="action" value="update" />';
wp_nonce_field("$option_group-options");
}
so, it gives the form processor some info to work with for the current options page, and verification with nonce on submit.
UPDATE
It’s role is made more clear in the Settings API docs:
To display the hidden fields and handle security of your options form, the Settings API provides the settings_fields() function.
settings_fields( $option_group );
Related Posts:
- Add multiple custom fields to the general settings page
- How can I get $id variable in widget’s form function?
- Refresh page after form action
- contactform7 remove tags with “wpcf7_autop false” from functions.php
- bloginfo() vs get_option?
- Add new user : make the fields First Name and Last name required
- How to call WordPress functions from a form processing script
- How do you permanently remove default rewrite rules from the wp_options table?
- Set default options for inserting media
- update_post_meta for custom field not working upon form submission
- Theme options WP Editor
- Updating users_can_register option?
- WordPress registration and contact form 7 [closed]
- Fatal error when trying to get admin email on contact form
- options.php problem – data not saved
- Gravity Forms – Using a Form to Pre-populate A Gravity Form [closed]
- Ninja form Redirect depending on text field content [closed]
- Hook specific functions if on a specific admin page
- WordPress upload_mimes not working for front-end uploads of 3D files
- Ajax not working properly
- Having a Function Inside of the Loop
- Two Types of settings in WP – The Doubt
- Removing custom meta data
- What is the correct way of updating wordpress options
- How to call particular funcion when the check box is checked in plugin options page
- Move Custom Fields on General Settings Page to New Location
- Is There Any Built In WP Functionality For Combining Form Fields To Return Specific Data
- wp_nonce_field is breaking form for reasons unknown
- Contact Form 7 If Condition
- How to properly refresh page after form action?
- Init action and refresh page after form action
- “options.php” not found
- How do I register a new settings page? [closed]
- dynamic enquiry form [closed]
- This code is supposed to only allow user to be authenticated if accountVerified is equal to 1, but it still allows user to be authenticated otherwise
- Problems adding a new field to product in cart
- Postback redirect through add_action is not triggered
- Button click counter for login user
- How to change form action of wp-login page with a function
- WordPress Ajaxifying not working properly
- Sending Messages Back to the Template After Processing?
- us states dropdown function and echo in theme template files
- Adding custom field in menu options [duplicate]
- Settings in functions.php used by a plugin
- Random text changing to weird icons in both admin & front end
- Register a widget area when a theme option has been saved?
- Gravity Forms After Submission – GFFormsModel::update_lead_field_value?
- Will my WordPress site become vulnerable after adding this functions which allows more HTML tags for subscribers?
- Help finishing script to export WP user data when form submitted
- Directing to functions.php the correct way
- WordPress Custom wp mail template return full template
- Get all users from role and add to dropdown (select) – wordpress, javascript
- Can’t find function which is called in a wordpress theme
- CF7 Remove Comma from ‘select’ ‘radio’ and ‘checkbox’ outouts
- How to redirect using a custom wordpress api endpoint after form submission?
- Missing feature image link function
- What’s the difference between home_url() and site_url()
- Remove “Category:”, “Tag:”, “Author:” from the_archive_title
- get_template_directory_uri pointing to parent theme not child theme
- How to customize the_archive_title()?
- remove empty paragraphs from the_content?
- What is the “with_front” rewrite key?
- Why use if function_exists?
- How to override parent functions in child themes?
- wp_enqueue_script was called incorrectly
- Ajax call always returns 0
- 400 bad request on admin-ajax.php only using wp_enqueue_scripts action hook
- How long does a deprecated function live in core?
- Solution to render Shortcodes in Admin Editor
- How to add a data attribute to a WordPress menu item
- What’s the difference between esc_html, esc_attr, esc_html_e, and so on?
- remove_action on after_setup_theme not working from child theme
- plugins_url vs plugin_dir_url
- Remove type attribute from script and style tags added by WordPress
- How to run a function every 5 minutes?
- Best way of passing PHP variable between partials?
- Upload Multiple Files With media_handle_upload
- How to display custom field in woocommerce orders in admin panel?
- Contact form 7 select box different value-text than content-text in option [closed]
- Adding fields to the “Add New User” screen in the dashboard
- Issues with title-tag and document_title_parts
- How do I get the current edit page ID in the admin?
- How to check if a user exists by a given id
- Why isn’t is_page working when I put it in the functions.php file?
- Add tags to the section via functions.php
- Add image size if page template
- How to create a custom order status in woocommerce!
- Remove Actions/Filters added via Anonymous Functions
- Adding a second email address to a completed order in WooCommerce [closed]
- How to load parent_theme functions.php before child_theme?
- How to load scripts/styles specific for a page
- Programatically add options to “add new” custom field dropdown
- Is there any global functions.php file which works for any theme?
- Excluding iPad from wp_is_mobile
- When should you, and when should you not, use wp_list_pluck()?
- Get the ID of the page a menu item links to?
- Add container to nav_menu sub menu
- Difference between the_permalink() and get_permalink() function
- What’s the difference between WordPress random_int() and PHP built-in function random_int()?
- Child theme – Overriding ‘require_once’ in functions.php