* Use integers for menu page priority

 In wordpress >= 6.0, the seventh parameter passed to add_menu_page() should be an integer representing menu position.

* Add changelog

* Fix Analytics & WcPayWelcomePage menu positions
This commit is contained in:
Chi-Hsuan Huang 2022-03-07 17:12:24 +08:00 committed by GitHub
parent 6c474ed5cb
commit be7e73d484
4 changed files with 8 additions and 4 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: Fix
Fix invalid parameter passed to add_menu_page() for wordpress >= 6.0. #8399

View File

@ -186,7 +186,7 @@ class Analytics {
'title' => __( 'Analytics', 'woocommerce-admin' ),
'path' => '/analytics/overview',
'icon' => 'dashicons-chart-bar',
'position' => 56, // After WooCommerce & Product menu items.
'position' => 57, // After WooCommerce & Product menu items.
);
$report_pages = array(

View File

@ -48,7 +48,7 @@ class WcPayWelcomePage {
'id' => 'wc-calypso-bridge-payments-welcome-page',
'title' => __( 'Payments', 'woocommerce-admin' ),
'path' => '/wc-pay-welcome-page',
'position' => '55.7',
'position' => '56',
'nav_args' => [
'title' => __( 'WooCommerce Payments', 'woocommerce-admin' ),
'is_category' => false,
@ -72,7 +72,7 @@ class WcPayWelcomePage {
'admin.php?page=wc-admin&path=/wc-pay-welcome-page',
null,
$menu_icon,
55.7,
56,
);
call_user_func_array( 'add_menu_page', $menu_with_nav_data );

View File

@ -440,7 +440,7 @@ class PageController {
$options['path'],
array( __CLASS__, 'page_wrapper' ),
$options['icon'],
$options['position']
intval( round( $options['position'] ) )
);
} else {
$parent_path = $this->get_path_from_id( $options['parent'] );