• Resolved meir321

    (@meir321)


    Hi, nothing is showing up when I search, the loader is just turning and I see the following error in the console.

    Uncaught SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
        at JSON.parse (<anonymous>)
        at Object.e [as transformResult] (search.min.js?ver=1.25.0:1:5892)
        at Object.<anonymous> (search.min.js?ver=1.25.0:1:26746)
        at c (jquery.min.js?ver=3.7.0:2:25266)
        at Object.fireWith [as resolveWith] (jquery.min.js?ver=3.7.0:2:26015)
        at l (jquery.min.js?ver=3.7.0:2:77721)
        at XMLHttpRequest.<anonymous> (jquery.min.js?ver=3.7.0:2:80204)

    Please advise, thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @meir321

    It is possible that your search results are being redirected to another site which is causing this error. I recently encountered a similar issue and it was related to the Yoast SEO plugin settings. Check if you have it installed and go to options and in the “Internal site search cleanup” section, uncheck all options. See screenshot: https://prnt.sc/WCn2pyMIydHr
    If you don’t have this plugin, check other plugins that have the redirect functionality available. Also, check the theme code if it has been modified.
    If this doesn’t help, start disabling each plugin one by one and checking the search at the end, leaving only WooCommerce and FiboSearch. Additionally, try changing the theme temporarily. This will allow you to determine what is causing the conflict.

    Regards,
    Kris

    Thread Starter meir321

    (@meir321)

    Hi, the Yoas features you mentioned were already disabled.

    It seems the issue was related to this snippet added to block the regular WordPress search functionality. It worked with other search plugins so didn’t think it’s an issue but I guess it’s not compatible with FiboSearch.

    function wpb_filter_query( $query, $error = true ) {
    if ( is_search() ) {
    $query->is_search = false;
    $query->query_vars[s] = false;
    $query->query[s] = false;
    if ( $error == true )
    $query->is_404 = true;
    }
    }
    add_action( 'parse_query', 'wpb_filter_query' );
    add_filter( 'get_search_form', create_function( '$a', "return null;" ) );
    function remove_search_widget() {
        unregister_widget('WP_Widget_Search');
    }
    add_action( 'widgets_init', 'remove_search_widget' );

    I disabled the search and now it works but there is still like a minute delay int he AJAX. Is it possible it has to do with HPOS enabled?

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘No Search Results & Error in Console’ is closed to new replies.