What use is the WordPress register_activation_hook() function?

Having been playing around with WordPress Network (Multisite) plugins, mostly internal, not doing much that anyone else would be interested in having. During a plugin’s lifetime it goes through some critical points. The one you can’t avoid is activation. Many also experience deactivation or even deletion. Most will, at some point, be updated. for these critical points the plugin author may want to have certain critical events happen. Setting up options, creating databases, pre-populating meta data. And of course the reverse – deleting said litter.

A quick summary of theĀ register_activation_hook() function:

  • It doesn’t work on multisite. Network activation does not trigger this function
  • Updating the plugin does not trigger it
  • It is triggered every time a plugin is manually re-activated

None of these are my desired behaviour. I usually write my own hook that checks if the plugin version has changed, and fire off my actions.

Which makes me wonder whether the function is out dated, and should be replaced a set of alternative functions. They could perhaps even be actions?

  • register_plugin_activation_hook
  • register_plugin_network_action_hook
  • register_plugin_update_hook
  • register_plugin_update_network_hook

WP Glossary WordPress Plugin Moves To GitHub

I’ve had a few enquiries about the ability to contribute to the WP Glossary plugin. No doubt this is due to my inactivity. Work, money, family, pets and all that stuff that makes up my simple life has meant there has been no time for any fun home projects. One thing suffering is WP Glossary.

It strikes me that, and probably many others, that GitHub is ideally suited for exactly such a thing as a WordPress plugin. I followed the instructions on a gist by kasparsdĀ and viola, it is done.

GitHub Link:Ā https://github.com/tcbarrett/WP-Glossary

I have never dealt with any kind of pull / clone / whatever requests. Nor have I played with branching on git. I dipped my toes in the subversion branch pool (does that scan?) and was frightened. So, please be kind.

If there’s still anyone out there who hasn’t lost patience with me and wants to add their bit, please do feel free. Just remember I’m still on a learning curve.

What triggers the WordPress register_uninstall_hook()?

I spent over an hour trying to figure out the user’s workflow when wanting to add an uninstall hook to a WordPress plugin. I did eventually stumble across the answer, which once you know probably seems blatantly obvious. However, it wasn’t for me at the time.

Question: How to trigger theĀ register_uninstall_hook() callback function?

Answer: Delete the plugin!

I spent a lot of my time looking for the uninstall link. Wondering if I was supposed to make my own. Not sure whether it being a Network Activated plugin made a difference. All the documentation and blog posts I could find just implied that it would all work out of the box. And, well, it does.

Delete Plugin And DataWhen you deactivate and then delete a plugin, it usually asks you for confirmation. With a plugin that has registered and uninstall hook, it adds some additional text. Personally I think that’s a little obfuscated, both to developers and to users. Maybe I’ll find the time to figure outĀ tracĀ andĀ submit a patch for recommending further emphasis. Hopefully, I will find somewhere to mention it on the wordpress.org documentation site.


Boost Your WordPress Hosting Speed – Linode Introduces Beta Solid State Hybrid

Hosting with an excellent VPS provider is always a great way to serve up a super fast WordPress website. Being able to configure your server for efficiency and speed, specifically targeted at handling the WordPress stack (MySQL, PHP, Nginx), can really lift you away from the average. And, without going into too much detail, everything in that stack relies on the speed of your disk. So disk speed matters.

We’ve developed a new Linode storage layer that includes a combination of ‘good stuff’ SSDs (in redundant pairs) and our proven hard drive storage system.

Linode appear to going from strength to strength. Whilst keeping their core unique selling point (reliability!), they are responding well to competition. As customers we are reaping the benefits.

Any idea if it’ll cost extra or not?

AsksĀ archon810 on the forums.

It will not. And, we will have a plan for upgrading most, if not all, of the existing fleet.