Require Minimum PHP Version to Activate a WordPress Theme

WordPress core only requires PHP 5.2 to run properly. This is great for compatibility with older hosts but this version of PHP was also released in 2006. Using a newer version of PHP provides more security, access to better development tools, and most of all: speed!

For this reason BigBox sets a minimum PHP version of 7.0 — which should be readily available on any reputable hosting company. Below is a quick snippet that blocks a theme from activating if it does not meet the defined PHP version and reverts the website back to the default theme.

UPDATE: The code below has been updated. The theme is no longer switched automatically so the notice persists on the backend. The notice is also now shown on the frontend.

Powering BigBox

Techniques like this and many more power the highly flexible and highly optimized BigBox WooCommerce theme.

Get BigBox Today →

Leave a Reply

Your email address will not be published. Required fields are marked *