woocommerce_save_settings_(current_tab)_(current_section)
Filters whether the posted data for a settings section should be saved.
The dynamic portions of the hook name, $current_tab and $current_section, are the sanitized tab and section request values of the settings screen being viewed.
Использование
add_filter( 'woocommerce_save_settings_(current_tab)_(current_section)', 'wp_kama_woocommerce_save_settings_current_tab_section_filter' );
/**
* Function for `woocommerce_save_settings_(current_tab)_(current_section)` filter-hook.
*
* @param bool $save Whether to save.
*
* @return bool
*/
function wp_kama_woocommerce_save_settings_current_tab_section_filter( $save ){
// filter...
return $save;
}
- $save(true|false)
- Whether to save.
По умолчанию: true when the settings form was submitted
Список изменений
| С версии 3.3.0 | Введена. |
Где вызывается хук
woocommerce_save_settings_(current_tab)_(current_section)
woocommerce/includes/admin/class-wc-admin-menus.php 198
if ( '' !== $current_section && apply_filters( "woocommerce_save_settings_{$current_tab}_{$current_section}", ! empty( $_POST['save'] ) ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Presence check only; WC_Admin_Settings::save() verifies the manage_woocommerce capability and the woocommerce-settings nonce before anything is written.
Где используется хук в WooCommerce
woocommerce/includes/admin/class-wc-admin-api-keys.php 22
add_filter( 'woocommerce_save_settings_advanced_keys', array( $this, 'allow_save_settings' ) );
woocommerce/includes/admin/class-wc-admin-webhooks.php 22
add_filter( 'woocommerce_save_settings_advanced_webhooks', array( $this, 'allow_save_settings' ) );