Skip to content

Commit

Permalink
Duplicated views: Force WP Admin view for Categories, Tags, Portfolio…
Browse files Browse the repository at this point in the history
…, and Tags (#40568)
  • Loading branch information
mmtr authored Dec 12, 2024
1 parent d349c0a commit bd2ff9b
Show file tree
Hide file tree
Showing 2 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


Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ function ( $location ) {
}
add_filter( 'pre_update_option_wpcom_admin_interface', 'wpcom_admin_interface_pre_update_option', 10, 2 );

const WPCOM_DUPLICATED_VIEW = array(
'edit.php',
'edit.php?post_type=jetpack-portfolio',
'edit.php?post_type=jetpack-testimonial',
'edit-tags.php?taxonomy=category',
'edit-tags.php?taxonomy=post_tag',
);

/**
* Get the current screen section.
*
Expand Down Expand Up @@ -148,13 +156,9 @@ function wpcom_admin_get_current_screen() {
* @return string Filtered wpcom_admin_interface option.
*/
function wpcom_admin_interface_pre_get_option( $default_value ) {
$enabled_screens = array(
'edit.php',
);

$current_screen = wpcom_admin_get_current_screen();

if ( in_array( $current_screen, $enabled_screens, true ) && wpcom_is_duplicate_views_experiment_enabled() ) {
if ( in_array( $current_screen, WPCOM_DUPLICATED_VIEW, true ) && wpcom_is_duplicate_views_experiment_enabled() ) {
return 'wp-admin';
}

Expand All @@ -177,7 +181,9 @@ function wpcom_admin_get_user_option_jetpack( $value ) {
$value = array();
}

$value['edit.php'] = Automattic\Jetpack\Masterbar\Base_Admin_Menu::CLASSIC_VIEW;
foreach ( WPCOM_DUPLICATED_VIEW as $path ) {
$value[ $path ] = Automattic\Jetpack\Masterbar\Base_Admin_Menu::CLASSIC_VIEW;
}

return $value;
}
Expand Down

0 comments on commit bd2ff9b

Please sign in to comment.