Forums › Forums › Search & Filter Pro › Accessing the Search Data
- This topic has 8 replies, 2 voices, and was last updated 7 years, 7 months ago by Anonymous.
-
Anonymous(Private) March 10, 2017 at 1:21 pm #95951
Hello,
when I try to output currently selected filter values, this is working:echo $sf_current_query->get_field_string(“_sfm_category”);
But this is not working, as well as any filter that start with _sfm:
echo $sf_current_query->get_field_string(“_sfm_character”);What can be reason?
Trevor(Private) March 10, 2017 at 2:07 pm #95968Do you mean
echo $sf_current_query->get_field_string("_sft_category");
with at
and not anm
?Does the guidance and examples in the documentation help?
Anonymous(Private) March 10, 2017 at 2:36 pm #95975I found some workaround, to display currently selected value:
$tmp = $sf_current_query->get_array(); echo $tmp["_sfm_character"]["active_terms"][0]["name"];
But it may be a bug in
get_field_string
method from documentation, which is not working in my case:echo $sf_current_query->get_field_string("_sfm_character");
Trevor(Private) March 10, 2017 at 3:12 pm #95997Custom fields, because of their variable data content and types, are returned as arrays, hence the examples in the documentation.
Taxonomies always return strings. If you have set the form element for a taxonomy to have a single choice, it will be a string that is returned, if you have set it for multi-choice, then it would return an array.
Does that explain why what you tired worked for one field in the form and not the other?
-
AuthorPosts