Hack: Add PHP Version Display To Your Dashboard

A lot of people are updating their servers from PHP 5 to PHP 7 right about now. It is said that WordPress 5.1 will strongly encourage you to update to PHP 7, and some version soon will require it. It is probably a good idea to be there anyway, as PHP 7.2 is the standard now and brings with it security and speed.

But how do you know which version of PHP you are using? You could check the server, like CPanel/WHM or whatever you’ve got. But it is nice to have confirmation to actually know what version your WordPress install is running. After all, you can install PHP 7.2, but still have 5.5 or something actually running on your domain.

Here’s a script that adds the PHP version to the At a Glance section of your Dashboard. Add it to your functions.php or custom plugin.

add_filter('dashboard_glance_items', 'wpfilter_glance_items');
function wpfilter_glance_items($items) {
	array_push($items, 'PHP Version: '.phpversion());
	return $items;
}

Leave a Reply

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