diff --git a/projects/packages/masterbar/changelog/update-remove-performance-menu-item b/projects/packages/masterbar/changelog/update-remove-performance-menu-item new file mode 100644 index 0000000000000..2300c80248710 --- /dev/null +++ b/projects/packages/masterbar/changelog/update-remove-performance-menu-item @@ -0,0 +1,4 @@ +Significance: patch +Type: added + +Hides the calypso based Performance menu item on wordpress.com, shows page-optimize based Performance menu item on Atomic sites. diff --git a/projects/packages/masterbar/src/admin-menu/class-admin-menu.php b/projects/packages/masterbar/src/admin-menu/class-admin-menu.php index 3b0085f29391d..4e52f6f966f05 100644 --- a/projects/packages/masterbar/src/admin-menu/class-admin-menu.php +++ b/projects/packages/masterbar/src/admin-menu/class-admin-menu.php @@ -395,8 +395,11 @@ public function add_options_menu() { add_submenu_page( 'options-general.php', esc_attr__( 'Newsletter', 'jetpack-masterbar' ), __( 'Newsletter', 'jetpack-masterbar' ), 'manage_options', 'https://wordpress.com/settings/newsletter/' . $this->domain, null, 7 ); // @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- Core should ideally document null for no-callback arg. https://core.trac.wordpress.org/ticket/52539. add_submenu_page( 'options-general.php', esc_attr__( 'Podcasting', 'jetpack-masterbar' ), __( 'Podcasting', 'jetpack-masterbar' ), 'manage_options', 'https://wordpress.com/settings/podcasting/' . $this->domain, null, 8 ); - // @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- Core should ideally document null for no-callback arg. https://core.trac.wordpress.org/ticket/52539. - add_submenu_page( 'options-general.php', esc_attr__( 'Performance', 'jetpack-masterbar' ), __( 'Performance', 'jetpack-masterbar' ), 'manage_options', 'https://wordpress.com/settings/performance/' . $this->domain, null, 9 ); + + if ( function_exists( 'wpcom_is_duplicate_views_experiment_enabled' ) && ! wpcom_is_duplicate_views_experiment_enabled() ) { + // @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal -- Core should ideally document null for no-callback arg. https://core.trac.wordpress.org/ticket/52539. + add_submenu_page( 'options-general.php', esc_attr__( 'Performance', 'jetpack-masterbar' ), __( 'Performance', 'jetpack-masterbar' ), 'manage_options', 'https://wordpress.com/settings/performance/' . $this->domain, null, 9 ); + } } /** diff --git a/projects/packages/masterbar/src/admin-menu/class-atomic-admin-menu.php b/projects/packages/masterbar/src/admin-menu/class-atomic-admin-menu.php index 0bcafb72c30b7..57ee461a3a0db 100644 --- a/projects/packages/masterbar/src/admin-menu/class-atomic-admin-menu.php +++ b/projects/packages/masterbar/src/admin-menu/class-atomic-admin-menu.php @@ -436,10 +436,13 @@ function_exists( 'wpcom_is_duplicate_views_experiment_enabled' ) && 11 ); - // Page Optimize is active by default on all Atomic sites and registers a Settings > Performance submenu which - // would conflict with our own Settings > Performance that links to Calypso, so we hide it it since the Calypso - // performance settings already have a link to Page Optimize settings page. - $this->hide_submenu_page( 'options-general.php', 'page-optimize' ); + // The calypso based Performance screen is no longer linked from wp-admin and no longer conflicts with the Page Optimize "Performance"submenu item. + if ( function_exists( 'wpcom_is_duplicate_views_experiment_enabled' ) && ! wpcom_is_duplicate_views_experiment_enabled() ) { + // Page Optimize is active by default on all Atomic sites and registers a Settings > Performance submenu which + // would conflict with our own Settings > Performance that links to Calypso, so we hide it it since the Calypso + // performance settings already have a link to Page Optimize settings page. + $this->hide_submenu_page( 'options-general.php', 'page-optimize' ); + } // Hide Settings > Performance when the interface is set to wp-admin. // This is due to these settings are mostly also available in Jetpack > Settings, in the Performance tab.