Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1000380

    I was able to implement this code in functions.php to ensure a specific product would not show up on the full search results archive page…

    function jp_search_filter( $query ) {
      if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) {
        $query->set( 'post__not_in', array( 5337 ) );
      }
    }
    add_action( 'pre_get_posts', 'jp_search_filter' );

    Sidebar: For those of you reading who want to exclude additional pages, just add more page IDs after the array. So 5337,3445,6789 and so on. More information here – https://www.johnparris.com/exclude-certain-pages-from-wordpress-search-results/

    But this code does not exclude results from the AJAX Enfold drop-down. The result will show up and you can click on it to get to the page. If you click on the View All Results link at the bottom of the AJAX search, you will not see the result on that page (the archive search results page).

    So, is their code I could add to functions.php to exclude a result or result from the Enfold AJAX search?

    Before I go adding plugins to try stuff out, I’d prefer to go this route since I’m only planning to exclude one or two pages/products. I’m already running a lot of plugins…

    #1000952

    Hey spidercreations,

    Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)

    Best regards,
    Basilis

    #1000974

    Is there even a way to turn off the AJAX search?
    Would installing something like Relevanssi allow me to not list a specific page, post or product in the AJAX search?

    #1001053

    Hi,
    Yes you can use Relevanssi with the ajax search. See https://kriesi.at/support/topic/is-there-a-searchbar-working-togehter-with-woocommerce/#post-990568

    Best regards,
    Dude

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.