Update to display full woocommerce version on status page rather than a shortened milestone style version (#46906)
* update to display actual woocommerce version on status page * Add changefile(s) from automation for the following project(s): woocommerce --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
f5d386f093
commit
296c0cfb23
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: update
|
||||
|
||||
Update the WooCommerce Status page to use the full plugin version to show dev, Beta and RC versions as opposed to only the milestone number
|
|
@ -29,6 +29,20 @@ $untested_plugins = $plugin_updates->get_untested_plugins( WC()->version, Cons
|
|||
$active_plugins_count = is_countable( $active_plugins ) ? count( $active_plugins ) : 0;
|
||||
$inactive_plugins_count = is_countable( $inactive_plugins ) ? count( $inactive_plugins ) : 0;
|
||||
|
||||
// Include necessary WordPress file to use get_plugin_data()
|
||||
if ( ! function_exists( 'get_plugin_data' ) ) {
|
||||
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
||||
}
|
||||
// Define the path to the main WooCommerce plugin file using the correct constant
|
||||
$plugin_path = WP_PLUGIN_DIR . '/woocommerce/woocommerce.php';
|
||||
// Initialize the WooCommerce version variable
|
||||
$wc_version = '';
|
||||
// Check if the plugin file exists before trying to access it
|
||||
if (file_exists($plugin_path)) {
|
||||
$plugin_data = get_plugin_data($plugin_path);
|
||||
$wc_version = $plugin_data["Version"] ?? ''; // Use null coalescing operator to handle undefined index
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="updated woocommerce-message inline">
|
||||
<p>
|
||||
|
@ -78,7 +92,8 @@ $inactive_plugins_count = is_countable( $inactive_plugins ) ? count( $inactive_p
|
|||
<tr>
|
||||
<td data-export-label="WC Version"><?php esc_html_e( 'WooCommerce version', 'woocommerce' ); ?>:</td>
|
||||
<td class="help"><?php echo wc_help_tip( esc_html__( 'The version of WooCommerce installed on your site.', 'woocommerce' ) ); /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></td>
|
||||
<td><?php echo esc_html( $environment['version'] ); ?></td>
|
||||
<td><?php echo esc_html( !empty($wc_version) ? $wc_version : $environment['version'] ); ?></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td data-export-label="REST API Version"><?php esc_html_e( 'WooCommerce REST API package', 'woocommerce' ); ?>:</td>
|
||||
|
|
Loading…
Reference in New Issue