Title: count() error
Last modified: October 30, 2019

---

# count() error

 *  [freekwp](https://wordpress.org/support/users/freekwp/)
 * (@freekwp)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/count-error-2/)
 * 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](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](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/count-error-2/#post-12079908)
 * it’s very likely due to [the get_the_content() call on line 633](https://github.com/futtta/wp-youtube-lyte/blob/master/wp-youtube-lyte.php#L633)
   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](https://wordpress.org/support/users/freekwp/)
 * (@freekwp)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/count-error-2/#post-12080060)
 * Thanks for the quick reply!
 * I changed that line, but the error remains.
 * Anything else that I can try?
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/count-error-2/#post-12081135)
 * 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](https://wordpress.org/support/users/freekwp/)
 * (@freekwp)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/count-error-2/#post-12081909)
 * 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](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/count-error-2/#post-12082397)
 * 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.

 * ![](https://ps.w.org/wp-youtube-lyte/assets/icon-128x128.png?rev=1836005)
 * [WP YouTube Lyte](https://wordpress.org/plugins/wp-youtube-lyte/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-youtube-lyte/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-youtube-lyte/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-youtube-lyte/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-youtube-lyte/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-youtube-lyte/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [6 years, 7 months ago](https://wordpress.org/support/topic/count-error-2/#post-12082397)
 * Status: not resolved