Someone reported a fatal error in Strong Testimonials that crashed her site. Fortunately, she provided the error message with the program file and line number that caused the fatal error.

That offending code had been in place for almost two years.

After so much time and 20,000 installs, I suspected a theme; either a new theme or a custom theme that needs some work or an old theme that has somehow escaped conflicts “in the wild” until now.

I’m actually really good at breaking things

I spent three hours trying to reproduce the problem and devise a solution. I studied the WordPress code and the online function reference. I coded several different scenarios. I logged every action before and after. I drank too much coffee. I swore once or twice.

I came to the conclusion that the most likely scenario was a theme that added thumbnail support incorrectly.

Yes, WordPress allows that to happen. I was surprised too.

My plugin was attempting to handle the situation where a theme added thumbnail support for specific post types only (e.g. post, movie, actor) instead of all post types by default.

Since themes are loaded after plugins, the theme’s list of supported post types would replace the plugin’s list instead of adding onto it. As a result, testimonial thumbnails wouldn’t work.

Like if your spouse threw out your shopping list and started a new one. Didn’t just forget it but actually threw it out.

While my code worked, somewhere in between WordPress 4.3 and now, similar yet better code was added to the core function so my code became redundant and I removed it in version 2.26.5.

Themes often get the last word

When it comes to post-related features like thumbnails, WordPress gives precedence to themes over plugins. And rightly so, the separation of concerns and all that, but the line is blurring, as evidenced by the improved WordPress function I mentioned.

I’ll save the rant about truly modular components with no distinction between theme and plugin for another day (complete with coffee and cursing). And don’t get me started on what qualifies as a “post type”.

Don’t shoot the messenger

An obsolete or poorly coded theme may still cause the condition but now the plugin will fail gracefully which is always better than a fatal error and a ton of code that attempts to handle every possible situation.

While the problem can still occur, I believe it is rare. If someone reports the symptom again, the first thing I will ask to check is the theme. Unfortunately, since my plugin has front-end output, it may appear to be the cause of the problem when it really just tripped over it.

Chris Dillon

About the author: Chris Dillon is a WordPress developer in Cleveland, Ohio, USA. When not trying to figure out why his plugins aren't working, he walks his rescue dog Gordo, takes a nap in the backyard or makes a mess in the kitchen.