Yoast: 7 reasons for malfunctioning plugins (and their fixes)
It happens to every plugin author: you receive emails from people that your plugin isn’t working. There are about 7 reasons that – for me – seem to be the root cause of up to 95% of these emails, and I thought I’d write them down and show you how I try to handle them.
1. Missing hooks
It annoys the *peep* out of me when I find out that my plugin is in fact working fine, but the *peep* theme author didn’t think it necessary to add a wp_head or wp_footer call. This happens more than you’d think, but in most cases you can’t really blame the user in question, the theme author is just a moron. For your reference: the wp_head() call needs to exist right before the closing call, and the wp_footer() call should be right before the closing tag.
I used to check for this in my plugin, but the code doing the check caused even more problems, so if you have a good solution for this, that’d be appreciated. I personally think WordPress shouldn’t even activate themes without these two hooks.
2. A caching plugin
If you’re looking at a cached version of a page, and you’ve just installed or reconfigured the plugin, chances are the changes aren’t reflected in the output yet. In my Google Analytics plugin, I’ve actually added cache clearing code for W3 Total Cache and WP Super Cache, if you’re a plugin author you might find it useful:
<?php if ( function_exists('w3tc_pgcache_flush') ) { w3tc_pgcache_flush(); } else if ( function_exists('wp_cache_clear_cache') ) { wp_cache_clear_cache(); } ?>
This is only necessary to do after you’ve saved settings that would change the output of your plugin of course.
3. You’re not supposed to see anything
My Google Analytics plugin has the option to hide the tracking code for certain user levels. Turns out that, when you enable this feature, you’re actually not seeing anything at all in the code. That’s a good thing, right? Wrong. It meant dozens of emails coming to me in the course of like 6 months, until I was smart enough to add the following message to the output of my plugin for those users:
echo "<!-- Google Analytics tracking code not shown because users over level ".$options["ignore_userlevel"]." are ignored -->n";
Remember that when people use W3 Total Cache’s minification feature, they won’t even see this. The solution is to wrap it in CDATA tags.
4. You have to actually enable the plugin!
Seems obvious right? Well it doesn’t always seem to be. I get this email about once every 2 months “your plugin doesn’t work, it’s shit. Help me fix it” (sometimes they’re nicer, oftentimes they’re worse
). The best part is when it’s followed, like 5 hours later, by “ehm I actually forgot to activate your plugin”. Happens to all of us, you know.
5. You haven’t configured the plugin yet
There’s a reason my plugins now scream at you to configure them as soon as they’re activated: I got emails saying it didn’t work, when the person emailing simply hadn’t even configured the plugin yet. Yeah I know, my plugin should be able to just guess what your analytics account is, I’d love to be able to, but alas… So, especially for those people who think I have magic skills, there’s now a warning in the admin:
And a notice in the source output:
echo "";
6. You can’t change the settings
Either you’re blind or another plugin is malfunctioning, but you can’t find the settings page for the plugin you want to configure. Luckily, WordPress has you covered (and yes, some people think that emailing the plugin author is the solution for that). Go to the plugins page, and click on the Settings link for the plugin:
That is of course, if the particular plugin actually was kind enough to include that link… For some reason, some plugin authors seem to think these standards don’t have to be adhered to. They deserve to get more email.
7. The plugin is incomplete
When you uploaded the plugin, you might have missed a file, or two. Or the upload went bust. Or the auto install went bust. It happens. I haven’t had to build in a check for this yet, since my plugins aren’t that big usually, but I noticed this in W3 Total Cache most recent changelog:
Added an additional notification to help users identify incomplete installations upon activation.
That shows you two things: A, Frederick knows what he’s doing and prevents people from emailing him over issues like that, B, it happens more often than you’d guess.
Your experiences
All the code examples above have been added to my plugin after several support requests for that particular issue. They might save you a fair bit of time if you’ve just started developing plugins, so feel free to use them. I know a fairly large portion of my readers dabbles with this stuff themselves, I’d love for you to share your experiences in the comments!
7 reasons for malfunctioning plugins (and their fixes) is a post from Joost de Valk‘s Yoast – Tweaking Websites.A good WordPress blog needs good hosting, you don’t want your blog to be slow, or, even worse, down, do you? Check out my thoughts on WordPress hosting!
No related posts.
