Adding the_content() return warning count()

I noticed this error myself too when using the Elementor plugin. It is only displayed when WP_Debug is set to true.

The location of the warning is wp-includes/post-template.php. This is not a theme location, so the short version is that you’re not responsible for it.

The error only appears when using Elementor. I think that the Elementor developers should fix this error, because it is their plugin that ‘conflicts’ with a wp-includes file. I expect that this will be fixed in a future version of Elementor.

My conclusion is that you can ignore this error message. It is only visible when WP_Debug is true and normal users seldom enable this. Plus, it is only a warning and not an error. As far as I know, the Elementor plugin is not hindered by it. (However, this could turn into an error in a future version of PHP when it is not fixed.) But for now you shouldn’t worry.

UPDATE PER 15/7/2020:

This error is caused by only using the_content() function outside of a loop. This function should be put inside a loop.

So replace

the_content();

with

    while ( have_posts() ) : the_post();
        the_content();
    endwhile; 

Replacing this made the error disappear, while my content and everything didn’t change. My guess now is that the count() function has to do sth with the wp count in the loop.