Forums › Forums › Search & Filter Pro › Not working on page load
Tagged: V3
- This topic has 10 replies, 2 voices, and was last updated 5 years, 11 months ago by Trevor.
-
Anonymous(Private) December 14, 2018 at 11:13 am #196334
Hello Team,
No matter where I search, I can’t find a way to make the plugin run on page load.
Once I start clicking around, the ajax filtering works fine, but I need it to work on the first page load too.
We are using the code below to remove one of the options and to set the default active item. This all works fine.
// Remove “All Courses” option and set main to default on Our Menu.
add_filter( ‘sf_input_object_pre’, function ( $input_object, $sfid ) {
if ( $sfid == 120 ) {
// var_dump($input_object);
if ( ( $input_object[‘name’] = ‘_sft_course’ ) ) {
if ( empty( $input_object[‘defaults’][0] ) ) {
$input_object[‘defaults’] = [ ‘main’ ];
}
$key = array_search( ‘All Courses’, array_column( $input_object[‘options’], ‘label’ ) );
if ( $key !== false ) {
unset( $input_object[‘options’][ $key ] );
$input_object[‘options’] = array_values( $input_object[‘options’] );
}
}
}return $input_object;
}, 10, 2 );Can you please tell me how to instruct the plugin to run in the fresh page load?
I can’t find the answer anywhere in the docs or internet.Thank you very much,
Kota -
AuthorPosts