You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Furthermore, as the site editor becomes more integrated with WP-ADMIN functionality, it would be good to have a way to generate admin URLs.
What is your proposed solution?
I can't find a canonical index of all admin pages. global $menu, $admin_page_hooks contain some., but not all, possible values.
One way might be to add a set of common admin URLs to the editor settings, for example, using the block_editor_settings_all PHP filter. admin_url would be run in this filter.
What problem does this address?
Gutenberg hardcodes paths to
wp-admin
pages, e.g,gutenberg/packages/block-library/src/site-logo/edit.js
Line 275 in f079bd2
The proposal is to run these links through, or generate them using, admin_url for use in the editor.
Why?
The admin URL can be filtered:
https://github.com/WordPress/wordpress-develop/blob/6.4/src/wp-includes/link-template.php#L3556-L3576
So can the site URL:
https://github.com/WordPress/wordpress-develop/blob/6.4/src/wp-includes/link-template.php#L3527
If folks are using these filters, Gutenberg should reflect the intended values.
Site running in a subdirectory might have different admin URLs as well, see:
Furthermore, as the site editor becomes more integrated with WP-ADMIN functionality, it would be good to have a way to generate admin URLs.
What is your proposed solution?
I can't find a canonical index of all admin pages.
global $menu, $admin_page_hooks
contain some., but not all, possible values.One way might be to add a set of common admin URLs to the editor settings, for example, using the block_editor_settings_all PHP filter. admin_url would be run in this filter.
There is a backwards compatibility risk involved in this as settings are intended to stick around.
Another option could be to create such a canonical index — perhaps a directory list of https://github.com/WordPress/wordpress-develop/tree/trunk/src/wp-admin — and a restricted (admin logged-in) API route to fetch it 🤷🏻
Related discussion:
The text was updated successfully, but these errors were encountered: