WC_Settings_Advanced::save()
Save settings.
Метод класса: WC_Settings_Advanced{}
Хуки из метода
Возвращает
null
. Ничего (null).
Использование
$WC_Settings_Advanced = new WC_Settings_Advanced(); $WC_Settings_Advanced->save();
Код WC_Settings_Advanced::save() WC Settings Advanced::save WC 9.7.1
public function save() { // phpcs:disable WordPress.Security.NonceVerification.Missing global $current_section; $prev_value = 'yes' === get_option( 'woocommerce_allow_tracking', 'no' ) ? 'yes' : 'no'; $new_value = isset( $_POST['woocommerce_allow_tracking'] ) && ( 'yes' === $_POST['woocommerce_allow_tracking'] || '1' === $_POST['woocommerce_allow_tracking'] ) ? 'yes' : 'no'; if ( apply_filters( 'woocommerce_rest_api_valid_to_save', ! in_array( $current_section, array( 'keys', 'webhooks' ), true ) ) ) { // Prevent the T&Cs and checkout page from being set to the same page. if ( isset( $_POST['woocommerce_terms_page_id'], $_POST['woocommerce_checkout_page_id'] ) && $_POST['woocommerce_terms_page_id'] === $_POST['woocommerce_checkout_page_id'] ) { $_POST['woocommerce_terms_page_id'] = ''; } // Prevent the Cart, checkout and my account page from being set to the same page. if ( isset( $_POST['woocommerce_cart_page_id'], $_POST['woocommerce_checkout_page_id'], $_POST['woocommerce_myaccount_page_id'] ) ) { if ( $_POST['woocommerce_cart_page_id'] === $_POST['woocommerce_checkout_page_id'] ) { $_POST['woocommerce_checkout_page_id'] = ''; } if ( $_POST['woocommerce_cart_page_id'] === $_POST['woocommerce_myaccount_page_id'] ) { $_POST['woocommerce_myaccount_page_id'] = ''; } if ( $_POST['woocommerce_checkout_page_id'] === $_POST['woocommerce_myaccount_page_id'] ) { $_POST['woocommerce_myaccount_page_id'] = ''; } } if ( class_exists( 'WC_Tracks' ) && 'no' === $new_value && 'yes' === $prev_value ) { WC_Tracks::track_woocommerce_allow_tracking_toggled( $prev_value, $new_value, 'settings' ); } $this->save_settings_for_current_section(); $this->do_update_options_action(); if ( class_exists( 'WC_Tracks' ) && 'yes' === $new_value && 'no' === $prev_value ) { WC_Tracks::track_woocommerce_allow_tracking_toggled( $prev_value, $new_value, 'settings' ); } } // phpcs:enable }