• Resolved alimirza13

    (@alimirza13)


    I have a website with Jet Smart filters so when I directly access the filters page the exclude posts are not excluded but when I re-apply filters it did work correctly.
    So is there any way to fix this like the excluded post should exclude in any scenario.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author quadlayers

    (@quadlayers)

    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

    Thread Starter alimirza13

    (@alimirza13)

    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 1 year, 5 months ago by alimirza13.
    Plugin Author quadlayers

    (@quadlayers)

    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.

    Thread Starter alimirza13

    (@alimirza13)

    Thanks will do.

    • This reply was modified 1 year, 5 months ago by alimirza13.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Posts not excluded from search’ is closed to new replies.