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)

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/12296097135

Upstream-Ref: Automattic/jetpack@bd2ff9b
  • Loading branch information
mmtr authored and matticbot committed Dec 12, 2024
1 parent dfabf10 commit 95ec756
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 91 deletions.
58 changes: 29 additions & 29 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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
Loading

0 comments on commit 95ec756

Please sign in to comment.