Forums › Forums › Search & Filter Pro › ajax is not working
Tagged: ajax, remove first option
- This topic has 19 replies, 3 voices, and was last updated 4 years, 7 months ago by Ross.
-
Ross Moderator(Private) May 21, 2020 at 11:17 am #245284
This is coming as an option in the admin area in S&F version 3.
For now you can do it with a PHP filter (add this to your child theme’s
functions.php
file):function sf_remove_first_option($input_object, $sfid){ // ensure we are only filtering the correct field name - in this case the field we want to filter has the name '_sft_post_tag' if( $input_object['name'] != '_sft_post_tag' ) { return $input_object; } // if we want to filter the options generated, we need to make sure the options variable actually exists before proceeding (its only available to certain field types) if( ! isset( $input_object['options'] ) ) { return $input_object; } // now we know we have options, remove the first option array_shift( $input_object['options'] ); return $input_object; } add_filter('sf_input_object_pre', 'sf_remove_first_option', 10, 2);
Change
_sft_post_tag
for the name of your field.Thanks
-
AuthorPosts