Leo Muniz
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Search with Algolia] Indexing errorHey 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 acount()
method, which was resulting in:
PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array
So I added ais_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 filewp-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.Forum: Plugins
In reply to: [WP Search with Algolia] elementor search template posts widget and Algolia@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 theis_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 withif ( is_search() && is_main_query() )
or
if ( $query->is_search() && $query->is_main_query() )
considering
$query
is the WP_Query object instance.Forum: Plugins
In reply to: [WP Search with Algolia] elementor search template posts widget and AlgoliaI 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.