Hello @alimirza13
Sorry for the late reply
Please check the $query of the filter
add_filter( ‘pre_get_posts’, array( $this, ‘search_filter’ ) );
Probably that plugin is removing or modifying the post__not_in property
Hey, I tried to put this in function.php
add_filter( 'pre_get_posts', array( $this, 'search_filter' ) );
But got the following error.
Uncaught Error: Using $this when not in object context in wp-content/themes/hello-elementor/functions.php:214
-
This reply was modified 2 years, 11 months ago by
alimirza13.
Hello @alimirza13
The function I’ve provided is not a fully implemented one.
You need to work on the implementation.
Here is a closer example, however, this will not implement the selected posts by Search Exclude.
add_filter( ‘pre_get_posts’, ‘filter_posts_by_id’ ); function filter_posts_by_id( $query ) { if ( !is_admin() && $query->is_main_query() ) { $query->set( ‘post__in’, array( 1, 2, 3 ) ); // replace 1, 2, 3 with the IDs of the posts you want to include } }
I suggest you contact the Jet Smart Filters developer about this issue, because this plugin is interfering with the WordPress filter.