[ad_1]
Another solution: set the excerpt length based on words, not characters. That’s the best way in any case, since it’s much faster than character-based excerpt length.
I tried reproducing the issue, but I can’t. I don’t know where the empty string is coming to the array; from that query, my test site comes up with array(5) { [0]=> string(9) "sleep(15)" [1]=> string(5) "sleep" [2]=> string(4) "test" [3]=> string(3) " 15" [4]=> string(1) "/" }.
When I manually added the empty string, I see it gets into an infinite loop. The problem isn’t that relevanssi_stripos() always returns false; it’s that it returns int(0) (which is how stripos() works).
I’ll fix this by adding a simple check in the foreach loop:
if ( ! $word ) {
continue;
}
