Tell us what you are trying to do?
Three weeks ago, I ask about this question in "https://toolset.com/forums/topic/limit-the-number-of-categories-for-search-filter/". I just tried the your suggestion by adding the code in Settings/Custom Code. The following is my code:
<?php
/**
* New custom code snippet (replace this with snippet description).
*/
toolset_snippet_security_check() or die( 'Direct access is not allowed' );
// Put the code of your snippet below this comment.
add_filter( 'wpv_filter_taxonomy_frontend_search_get_terms_args', 'func_include_exclude_tags', 10, 3 );
function func_include_exclude_tags( $args, $tax, $view_id ){
error_log( "*** func_include_exclude_tags, View ID = " . $view_id . "tax = " . $tax);
if ( $view_id == 12926 && $tax = 'taxonomy-slug' ){
$args['include'] = array( 2, 3, 4, 14, 346 ); // Edit array of term IDs you want to allow of your 4 terms
}
return $args;
}
But I don't see it's working on this page: hidden link even I have activated the code.
The page id 12926, which I used it in view_id. On the left side, I only want these category: Editorials (id = 346), Reviews (id = 2), Analysis (14), Developments (3), and New Voices (4)
In the WP debug.log, I don't see my error_log line, but I see this:
[09-Jan-2023 02:38:39 UTC] PHP Deprecated: Return type of Toolset_Settings::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /data/www/iconnectblog/wordpress/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-common/inc/toolset.settings.class.php on line 258
[09-Jan-2023 02:38:39 UTC] PHP Deprecated: Return type of Toolset_Settings::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /data/www/iconnectblog/wordpress/wp-content/plugins/toolset-blocks/vendor/toolset/toolset-common/inc/toolset.settings.class.php on line 268
I am using WP 6.1, twentytwentythree theme (Full Site Editing).
Please help