# force-refresh/2.1.5/includes/actions/admin/inc.save-options.php

Force Refresh, version 2.1.5. 43 lines.

- Page: https://pluginprobe.com/plugins/force-refresh/2.1.5/code/includes/actions/admin/inc.save-options.php
- Raw: https://pluginprobe.com/plugins/force-refresh/2.1.5/raw/includes/actions/admin/inc.save-options.php
- Modified: 2020-09-16T23:04:42+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/force-refresh/2.1.5/code/includes/actions/admin/inc.save-options.php#L10-L20`.

```php
<?php
/**
 * Our action for saving options from the admin page.
 *
 * @package ForceRefresh
 */

namespace JordanLeven\Plugins\ForceRefresh;

/**
 * Hook used to save admin actions for Force Refresh.
 */
add_action(
    'admin_init',
    function () {
        // If we are saving data from the Force Refresh options.
        if (
            isset( $_POST['force-refresh-admin-options-save'] ) &&
            'true' === $_POST['force-refresh-admin-options-save']
          ) {
            check_admin_referer( WP_FORCE_REFRESH_ACTION, 'nonce' );
            // Get updated options for viewing the refresh button in the WP Admin bar.
            $show_in_admin_bar = isset( $_POST['show-in-wp-admin-bar'] )
            ? sanitize_text_field(
                wp_unslash( $_POST['show-in-wp-admin-bar'] )
            ) : false;
              // Update the show in Admin Bar option.
              update_option( WP_FORCE_REFRESH_OPTION_SHOW_IN_WP_ADMIN_BAR, $show_in_admin_bar );
              // Get updated options for the refresh interval.
              $refresh_interval = isset( $_POST['refresh-interval'] )
                ? sanitize_text_field( wp_unslash( $_POST['refresh-interval'] ) ) : null;
              // If the new refresh interval option came through all right.
            if ( $refresh_interval ) {
                // Update the refresh interval.
                update_option(
                    WP_FORCE_REFRESH_OPTION_REFRESH_INTERVAL_IN_SECONDS,
                    $refresh_interval
                );
            }
        }
    }
);

```
