HUSKY - Product Filter for WooCommerce

woof_front_builder_options_after_update

在前端构建器选项更新后、保存到数据库之前,过滤整个选项数组。

参数

$options (array) — 当前前端构建器实例的所有选项的关联数组,包括刚刚更新的字段。

源文件

ext/front_builder/classes/options.php:67

代码示例


add_filter('woof_front_builder_options_after_update', function($options) {
    // Ensure a certain option always has a minimum value
    if (isset($options['max_posts']) && $options['max_posts'] < 1) {
        $options['max_posts'] = 1;
    }
    return $options;
});

使用说明

  • 在 AJAX 的 save_options() 方法期间运行。
  • 接收单个字段更新合并后的完整选项关联数组。
  • 结果经过 JSON 编码后存储在自定义数据库表中。