Use the code LIFETIME at checkout and get 20% off our limited-time lifetime plans. Offer available until September 21.

How to get the PHP, WordPress, and plugins versions using WPCodeBox

BlogHow to get the PHP, WordPress, and plugins versions using WPCodeBox

When debugging a piece of code or contacting support about a plugin, it's helpful to provide some minimum data about the stack you are running.

This info includes the PHP version, WP version, and even what plugins and at which versions you have them installed.

Getting this info is super easy using WPCodeBox, it being the only code snippet plugin that allows you to run snippets manually and see the output directly.

A snippet that would allow you to see the php version, plugin version and installed plugins is this:

$plugins = get_plugins();
global $wp_version;

echo "PHP Version: " . phpversion() . "\n";
echo "WordPress Version: " . $wp_version . "\n";
echo "\n\nPlugin Name -> Plugin Version\n\n";

foreach( $plugins as $plugin ) {
echo "$plugin[Name] -> $plugin[Version] \n";

The next steps will show you how to createa a manually running snippet.

To get the info, we will create a new snippet and select "Manual (On Demand)" as its run type. Then, in the toolbar, you will have a run button. WPCodeBox will show the code output under the editor. This snippet won't run automatically, only when you click the "Run" button.

After you created the snippet, you can add the code, save the snippet and click run. Don't forget to save the snippet before running it, if there are unsaved changes, the SAVE button will be orange.

The output, at the bottom of the editor, would look like this:

Caution: Don't share this data with people you don't trust, as some WP Plugins can have vulnerabilities at specific versions, and that data shouldn't be public.

This snippet is a useful one to save to your cloud account, so you have it ready on any site you need it.

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram