• Hi Frank,

    First of all: great work on this plugin and autoptimize!

    I’ve run into an issue that might be related to WP YouTube Lyte. My error log is showing the following:

    “PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /www/mydomain/public/wp-includes/post-template.php on line 310”

    I check with query monitor, and it indicates this error is related to WP YouTube Lyte. Here’s a screenshot: https://snipboard.io/BPD9bu.jpg

    Any thoughts on what this might be and what I might try to do to fix it?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    it’s very likely due to the get_the_content() call on line 633 as part of the excerpt trimmer filter, you _could_ try passing the $post object there, so turning

    $text = get_the_content('');
    into
    $text = get_the_content( $post );

    let me know if that helps!
    frank

    Thread Starter freekwp

    (@freekwp)

    Thanks for the quick reply!

    I changed that line, but the error remains.

    Anything else that I can try?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    To be honest; I wouldn’t know really. I checked the php-errorlog on my own server and can’t find a single instance of that error so I don’t have a lot to go on :-/

    Thread Starter freekwp

    (@freekwp)

    Hi Frank,

    Yeah, if you can’t replicate the issues, it’s really hard to figure it out.

    I set up a staging environment to do some more tests. Disabling WP YouTube Lyte gets rid of the error, but so does changing the theme to Twenty Nineteen. So it looks like the theme doesn’t play nice for some reason. Mystery solved ??

    Thanks for your help!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ah, wp-includes/post-template.php indeed handles theme’s templates, so this could be issue with a template.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘count() error’ is closed to new replies.