Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey Saumya,
    I had the same problem earlier today and it was actually a PHP Fatal Error in a third-party plugin. And my server was not adding the error the PHP error log either. This plugin was trying to use a not always countable/array variable in a count() method, which was resulting in:

    PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array

    So I added a is_array() before it to prevent the error from happening and, then, I could index all the content (+10k posts and pages) properly.

    To learn the error I was getting, I first activated the WP debug in wp-config.php with:
    define( 'WP_DEBUG', true );

    Then, I tried to index the content through the plugin UI one more time to intentionally trigger the error and, once it was triggered, I opened the file wp-content/debug.log, which showed me the file/line where the Fatal Error was happening.

    Considering you are always getting the error in 48%, it seems the code stops always at the same moment. So I wouldn’t think it is a timeout issue. To me a page or post to be indexed is triggering a condition that is causing an error somewhere in a plugin or in the theme. Good luck.

    @tw2113 It was for the original message.

    Many different plugins mess up with the main query. In my case, I was thinking of Beaver Builder, but it was actually FacetWP and I only learned that when disabling FacetWP for testing. Without it, WP Search with Algolia worked well. So I found a way to disable it only for the search page by using the is_search() method.

    I know this thread has already 3 months and the problem is probably already fixed by now. But, for anyone facing similar issues, it’s worth trying to disable some plugins that potentially change the WP main query behavior one by one to see if WP Search with Algolia works as expected.

    Then, when finding the culprit, develop a way to bypass it for the search page with

    if ( is_search() && is_main_query() ) 

    or

    if ( $query->is_search() && $query->is_main_query() ) 

    considering $query is the WP_Query object instance.

    I had a similar issue with Beaver Builder + FacetWP. It turns out the culprit was FacetWP and I needed to disable it. But I couldn’t simply do it because it was being using across the whole site for different purposes. So I used this code snippet below in the functions.php to disable FacetWP only when searching for content:

    add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) {
    if ( $query->is_search() && $query->is_main_query() ) {
    $is_main_query = false;
    }

    return $is_main_query;
    }, 5, 2 );

    So maybe the issue is not with Elementor and, if so, Elementor is probably messing with the WP Main Query and you should check how to disable this through Elementor hooks.

Viewing 3 replies - 1 through 3 (of 3 total)