Minimum PHP Required for WordPress

WordPress will work with PHP 5.2.4+ and MySQL 5.0+ but the WordPress docs suggest sites run on 5.6 or greater (April 6, 2016).

For personal themes/plugins I would suggest supporting at least php 5.5, but for plugins/themes you are trying to sell you may want to go down to 5.3. While PHP versions 5.5 is nearing end of life and 5.4 and below are no longer actively supported, supporting lower version would also avoid the headache of people giving your plugin/theme bad reviews if it “didn’t work properly” when they are running an outdated PHP version.

Here are the current results of what php versions sites are using that are running wordpress:

5.2 : 8.545%
5.3 : 22.987%
5.4 : 33.878%
5.5 : 18.161%
5.6 : 15.512%
7.0 : 0.916%

You can check the version of php as well as wordpress on activation of your plugin and auto disable it with an optional notification. This would allow you to to use a higher php version and let you notify the user that they need to update their php version when they try to activate the plugin. This would avoid what I mentioned earlier about users/customers freaking out or giving you a bad review because the plugin broke, caused errors, or just didn’t work on their site.

Also, there are several great “boilerplates” out there that give you a great foundation for building themes and plugins. I suggest using or looking through which should (for the most part) ensure you’re “doing it right”.

Here’s a few of the most popular:

  1. Plugin Boilerplate
  2. Plugin Boilerplate Generator
  3. Roots Theme Development Starter
  4. Underscores Theme Generator
  5. Bones Starter Theme

Lastly, if you’re just learning PHP and your goal is to develop wordpress themes or plugins, I wouldn’t spend much if any time trying to learn outdated practices. There are several useful tools you can use to test your php and know what version it will run on (like this or PHPCompatibility. This way you can check what minimum version the user will need if you’re unsure. Alongside this you can use WP-CLI for unit tests (it also lets you do a ton of other awesome things while developing). Also, most php is backward compatible so a lot of times using older features will still work in newer versions.

If compatibility is your main concern, make sure you are following development guidelines as outlined by the Theme Review Team and use the Theme Check plugin or something similar for plugins.

Final note:
If you’re selling on an online marketplace you’ll need to pass a similar theme/plugin review that wordpress.org does before you’re allowed to sell with them. So you should always try to follow guidelines provided by wordpress.org. However, online marketplaces can have slightly different requirements (like themeforest) so if you’re still concerned you should check with them.