简体   繁体   中英

How can I get WordPress plugin version number on the theme?

I want to get a specific plugin version number on my theme area. For example, I want to show the currently active WooCommerce plugin version number. How can I get it?

Thanks

You need something like this

$plugin_dir = WP_PLUGIN_DIR . '/woocommerce/woocommerce.php';

$plugin_data = get_plugin_data($plugin_dir);

echo $plugin_data['Version'];

Yes, it's working. But the array 'version' word would be capital word 'Version'. Otherwise, it's showing Notice: Undefined index.

$plugin_dir = WP_PLUGIN_DIR. '/woocommerce/woocommerce.php';

$plugin_data = get_plugin_data($plugin_dir);

echo $plugin_data['Version'];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM