Skip to content

wpcom-admin-bar: add Emails, Plugins, and Themes links#49822

Open
StevenDufresne wants to merge 8 commits into
trunkfrom
add/wpcom-admin-bar-management-links
Open

wpcom-admin-bar: add Emails, Plugins, and Themes links#49822
StevenDufresne wants to merge 8 commits into
trunkfrom
add/wpcom-admin-bar-management-links

Conversation

@StevenDufresne

@StevenDufresne StevenDufresne commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Related to DOTMSD-1338
Related to Automattic/wp-calypso#111871.

Proposed changes

The WordPress.com logo menu in the wp-admin admin bar only offered Sites and Domains, while the Calypso masterbar's equivalent menu also has Emails, Plugins, and Themes. This brings the admin bar in line.

Where the new links point depends on whether the user's default WordPress.com experience is the hosting dashboard (their hosting dashboard opt-in preference):

  • Enrolled: Emails and Plugins open the hosting dashboard (my.wordpress.com).
  • Not enrolled: Emails is hidden and Plugins opens classic Calypso.
  • Themes always opens classic Calypso in a new tab — it isn't part of the hosting dashboard yet.

The preference is read locally on Simple sites and from the user's WordPress.com preferences on Atomic.

Screenshots

Modern Sunset
Screenshot 2026-06-26 at 11 11 23 AM Screenshot 2026-06-26 at 11 11 10 AM

Considerations

  • Enrollment is cached per user for an hour (transient), not resolved on every render — the admin bar renders on every page and the Atomic lookup is a network call. Tradeoff: an opt-in change can take up to an hour to surface.
  • Themes external arrow: Themes opens in a new tab, so it shows a trailing ↗. The arrow inherits the link's color so it looks right in every admin color scheme — otherwise the modern scheme (ported in MU WPCOM: Port the fix of the modern color scheme from WP 6.8 #42462) tinted it blue whenever the (W) menu opened.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No. It reads an existing user preference to decide link destinations; no new tracking.

Testing instructions

  • As a user enrolled in the hosting dashboard (or force it with the wpcom_admin_bar_hosting_dashboard_enrolled filter), open wp-admin and click the WordPress.com logo. Confirm the menu shows Sites, Domains, Emails, Plugins, Themes, with Emails/Plugins pointing to my.wordpress.com and Themes opening wordpress.com/themes in a new tab.
  • As a not-enrolled user, confirm the menu shows Sites, Domains, Plugins, Themes (no Emails), with Plugins pointing to classic Calypso.
  • Verify on both a Simple and an Atomic site.
  • Open the (W) menu and confirm the Themes arrow uses the normal submenu text color — it should only turn the accent color when you hover the Themes row itself, not when the menu first opens.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (WordPress.com Site Helper), and enable the add/wpcom-admin-bar-management-links branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack-mu-wpcom-plugin add/wpcom-admin-bar-management-links

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jun 22, 2026
@jp-launch-control

jp-launch-control Bot commented Jun 22, 2026

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/jetpack-mu-wpcom/src/features/wpcom-admin-bar/wpcom-admin-bar.php 193/329 (58.66%) 6.42% 8 💔

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

@StevenDufresne StevenDufresne force-pushed the add/wpcom-admin-bar-management-links branch 2 times, most recently from a8a3626 to 505c7fd Compare June 25, 2026 06:59
StevenDufresne and others added 7 commits June 26, 2026 09:19
Mirror the Calypso masterbar W-menu in the wp-admin admin bar:

- Resolve the user's hosting dashboard enrollment server-side from the
  `hosting-dashboard-opt-in` preference (read locally on Simple, via
  /me/preferences on Atomic), cached per user.
- Enrolled: Emails and Plugins point to my.wordpress.com.
- Not enrolled: Plugins points to classic Calypso; Emails is hidden.
- Themes always opens classic wordpress.com/themes in a new tab.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The per-user transient could serve a stale pre-opt-in value for up to an
hour, so a user who opted into the hosting dashboard would not see the
updated menu (Emails link, my.wordpress.com Plugins) until the cache
expired. Resolve the preference fresh on each render instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
On Atomic the enrollment lookup calls /me/preferences, which the admin
bar would otherwise hit on every render. Cache the per-user result in a
transient for an hour, matching the help-center per-user preference
cache. Opt-in changes propagate within the hour.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Themes opens classic Calypso in a new tab but had no external indicator.
Render a trailing external arrow (gridicons "external", at reduced
opacity) on the node, matching the Calypso masterbar's ExternalLink.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Use a plain ↗ character in the node title instead of an icon, marking
the Themes sub-item as opening classic Calypso in a new tab.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a thin diagonal arrow (↗) to the Themes sub-item as a decorative
::after mask icon rather than link text, so it stays out of the
accessibility tree and mirrors correctly under [dir="rtl"].

The icon inherits the link color (color: inherit + background-color:
currentColor) to remain admin-color-scheme aware. color: inherit is
required to beat the WP 6.8 "modern" color scheme rule
`#wpadminbar:not(.mobile) li:hover .ab-item::after { color }` (a verbatim
core port from #42462 / core #62219), which otherwise tints the arrow
accent-blue whenever the parent (W) menu is hovered open.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@StevenDufresne StevenDufresne force-pushed the add/wpcom-admin-bar-management-links branch from c6d5814 to 51af15a Compare June 26, 2026 02:09
@StevenDufresne StevenDufresne marked this pull request as ready for review June 26, 2026 02:16
@StevenDufresne StevenDufresne requested a review from a team June 26, 2026 02:16
}
}

$enrolled = in_array( $opt_in_value, array( 'opt-in', 'forced-opt-in' ), true );

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can we handle users who are in rollout cohort? I guess there is no way...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah... you're right... the logic is only in Calypso side...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... do i reproduce the logic here? It's simple enough....

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem is the flag is not synced... maybe we should handle rollout cohort in backend 🤔

Add a test for the IS_WPCOM (Simple) preference-read path via a
get_user_attribute stub. Mark the Atomic remote-request block
@codeCoverageIgnore — it's signed I/O over Connection\Client, exercised
in the connection package and not reliably mockable here.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[mu wpcom Feature] Wpcom Admin Bar [Package] Jetpack mu wpcom WordPress.com Features [Status] In Progress [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants