Read Plugin Version Of Any WordPress Plugin

[ad_1]

Using the get_file_data() function. More efficient than using get_plugin_data() function.

$plugin_data = get_file_data( WP_PLUGIN_DIR . '/plugin-folder-name-in-wp-content-plugins-folder/plugin-main-file.php', array( 'Version' => 'Version' ) );

$plugin_data[‘Version’] will have the version.

To read version from within the same plugin:

$plugin_data = get_file_data( __FILE__, array( 'Version' => 'Version' ) );

Refer: https://wordpress.stackexchange.com/a/285644/90061

Pro tip: Use version_compare() PHP function to compare versions.

[ad_2]

PROMEX · YOUR ACCOUNT

Login / Register

Use your WhatsApp number. We’ll send you a code to sign in securely.

Your code expires in 5 minutes. Never share it with anyone.