HUSKY - Products Filter Professional for WooCommerce

woof_set_shortcode_taxonomyattr_behaviour

woof_set_shortcode_taxonomyattr_behaviour

Позволяет изменить поведение атрибута taxonomies в шорткоде [woof_products] и [woof_products_ids_prediction].

Parameters

$taxonomies_string (string) — строка с таксономиями из атрибута шорткода

Source File

index.php

Code Example

add_filter('woof_set_shortcode_taxonomyattr_behaviour', function($taxonomies_string) {
    // Force specific taxonomy to always be included
    $additional = 'product_tag:featured,on_sale';
    if (!empty($taxonomies_string)) {
        $taxonomies_string .= '+' . $additional;
    } else {
        $taxonomies_string = $additional;
    }
    return $taxonomies_string;
});

Usage Notes

  • Add this code to your theme's functions.php file or a custom plugin.
  • The hook is applied during the filtering process — changes take effect immediately.
  • Always return the expected value type from the callback function.