An easy way to handle minimum system requirements in WordPress Plugins

WP-Requirements is nice little library that I extracted out of a few plugins that I am writing. It allows a very easy way to manage both checking for system requirements and displaying them to users.

It uses a neat technique by Square Penguin. The idea is to use the double request that WordPress makes while activating plugins to display custom error messages to the user.

This allows you to change a cryptic plugin activation message like this,

Cryptic Activation Error

into a more relevant message like this.

Requirements Error Message

The plugin contains a FauxPlugin that goes about the WordPress plugin activation lifecycle internally. The advantage with this approach is that your real plugin doesn’t need to change at all.

Only if the requirements are satisfied does your real plugin kick in. The FauxPlugin is like a failsafe to ensure system requirements are met.

If you build specific types of plugins you can easily build a custom MinRequirements class that can be reused across all your plugins.

More information is available on the GitHub project for WP-Requirements.

  • Ryan Hellyer

    Holy cow. That’s a brilliant idea!