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-encoded 并存储在自定义数据库表中。