settings_fields

The timeline below displays how wordpress function settings_fields has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Outputs nonce, action, and option_page fields for a settings page.
 *
 * @since 2.7.0
 *
 * @param string $option_group A settings group name. This should match the group name
 *                             used in register_setting().
 */
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");
}

WordPress Version: 5.4

/**
 * Output nonce, action, and option_page fields for a settings page.
 *
 * @since 2.7.0
 *
 * @param string $option_group A settings group name. This should match the group name
 *                             used in register_setting().
 */
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");
}

WordPress Version: 3.7

/**
 * Output nonce, action, and option_page fields for a settings page.
 *
 * @since 2.7.0
 *
 * @param string $option_group A settings group name. This should match the group name used in register_setting().
 */
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");
}