Skip to content

Commit

Permalink
Remove Settings > Performance menu item (#41145)
Browse files Browse the repository at this point in the history
* Hide Performance menu item when duplciate views experiment is enabled

* changelog

* Instead of hiding, don't add it instead - covers simple and atomic.

* Fix phan-suppress annotation placement

* Prevent hiding of page-optimize menu item when in the holdout group

* Update changelog based on prev commit
  • Loading branch information
lsl authored and coder-karen committed Jan 24, 2025
1 parent b784f34 commit 9e291f7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9e291f7

Please sign in to comment.