Command Palette: Disable site editor navigation commands on Network Admin#72572
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +52 B (0%) Total Size: 2.21 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 16219c8. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/18714565599
|
ntsekouras
left a comment
There was a problem hiding this comment.
Tested and LGTM, thanks! I also searched if /wp-admin/network could be configurable and it seems it's not.
|
@ntsekouras Thanks for the review! |
…dmin (#72572) Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
|
I just cherry-picked this PR to the wp/6.9 branch to get it included in the next release: 6af5ed7 |
|
It only works if the pathname starts with We have many multisites where WordPress is in a folder, so we have the pathname |
|
@Soean Thanks for the feedback!
This is an extreme example, but I realized that it's also possible that the folder itself contains the string In this case, the site editor navigation commands should not be disabled, but I don't know how to accurately determine whether it's a multisite or not using JavaScript 🤔 |
|
Yes, this will not work reliably. I also have a multisite with subfolders. |
|
Using https://developer.wordpress.org/reference/functions/is_network_admin/ should help. |
|
@TobiasBg Thanks for the feedback! Yes, it would be better to perform the checks accurately on the server side. I will submit a follow-up PR later. |
…dmin (WordPress#72572) Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
What? Why?
The Site Editor is not available in the Multisite Network Admin screen and must be disabled.
How?
Check if
window.location.pathnameincludes/wp-admin/network.Another approach might be to check for
is+network_admin()on the server side and pass the result to theinitializeCommandPalettefunction.Testing Instructions
Make the following changes to
.wp-env.jsonand runnpm run start.Go to: Stylesare displayed.