Automattic\WooCommerce\Admin\Features
LaunchYourStore::preload_settings()
Preload settings for Site Visibility.
Метод класса: LaunchYourStore{}
Хуков нет.
Возвращает
Разное
.
Использование
$LaunchYourStore = new LaunchYourStore(); $LaunchYourStore->preload_settings( $settings );
- $settings(массив) (обязательный)
- settings array.
Код LaunchYourStore::preload_settings() LaunchYourStore::preload settings WC 9.7.1
public function preload_settings( $settings ) { if ( ! is_admin() ) { return $settings; } $current_screen = get_current_screen(); $is_setting_page = $current_screen && 'woocommerce_page_wc-settings' === $current_screen->id; // phpcs:disable WordPress.Security.NonceVerification.Recommended $is_woopayments_connect = isset( $_GET['path'] ) && isset( $_GET['page'] ) && ( '/payments/connect' === sanitize_text_field( wp_unslash( $_GET['path'] ) ) || '/payments/onboarding' === sanitize_text_field( wp_unslash( $_GET['path'] ) ) ) && 'wc-admin' === $_GET['page']; // phpcs:enable if ( $is_setting_page || $is_woopayments_connect ) { // Regnerate the share key if it's not set. add_option( 'woocommerce_share_key', wp_generate_password( 32, false ) ); $settings['siteVisibilitySettings'] = array( 'shop_permalink' => get_permalink( wc_get_page_id( 'shop' ) ), 'woocommerce_coming_soon' => get_option( 'woocommerce_coming_soon' ), 'woocommerce_store_pages_only' => get_option( 'woocommerce_store_pages_only' ), 'woocommerce_private_link' => get_option( 'woocommerce_private_link' ), 'woocommerce_share_key' => get_option( 'woocommerce_share_key' ), ); } return $settings; }