function delete_link($id = '') { if (!$id) { $this->error(); } $links = get_option($this->settings_field); if (array_key_exists($id, (array) $links)) { unset($links[$id]); update_option($this->settings_field, $links); } else { $this->error(); } accesspress_admin_redirect($this->page_id, array('deleted' => 'true')); }
/** * Register the database settings for storage. * * @since 0.1.0 * * @return null Returns early if not on the correct admin page */ public function register_settings() { /** If this page doesn't store settings, no need to register them */ if (!$this->settings_field) { return; } register_setting($this->settings_field, $this->settings_field); add_option($this->settings_field, $this->default_settings); if (!accesspress_is_menu_page($this->page_id)) { return; } if (accesspress_get_option('reset', $this->settings_field)) { update_option($this->settings_field, $this->default_settings); accesspress_admin_redirect($this->page_id, array('reset' => 'true')); exit; } }