Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › asp_query_args & post_in › Reply To: asp_query_args & post_in
October 18, 2021 at 5:57 pm
#35207
Participant
I can see a potential method… but can’t get it working.
The $_REQUEST [options] contains some of the query string.
I have tried registering a custom query variable
add_filter( 'query_vars', 'add_query_vars_filter' );
function add_query_vars_filter( $vars ){
$vars[] = 'custom_var';
return $vars;
}
but ASP but not pass it to the asp_query_args filter/AJAX call
I have tried adding a custom ASP front-end filter
add_action('asp_pre_parse_filters', 'asp_add_my_own_filters', 10, 2);
function asp_add_my_own_filters($search_id, $options) {
$filter = wd_asp()->front_filters->create(
'custom_field',
'Text stock',
// text or hidden
'text',
array(
'field' => '_stock_status',
// See operator list on above example
'operator' => 'eq'
)
);
$filter->add(array(
'label' => 'Stock status',
'value' => 'instock',
'default' => 'instock'
));
$filter->selectByOptions($options);
wd_asp()->front_filters->add($filter);
}
but I cannot override this via the query string…
Any ideas as to a viable solution?
-
This reply was modified 4 years, 7 months ago by
willfaulds59.