[wp-trac] [WordPress Trac] #54304: Expose menu data public in Menus REST API
WordPress Trac
noreply at wordpress.org
Tue Oct 1 20:10:36 UTC 2024
#54304: Expose menu data public in Menus REST API
---------------------------------------------------+-----------------------
Reporter: spacedmonkey | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.7
Component: REST API | Version: 4.7
Severity: normal | Resolution:
Keywords: has-patch needs-testing needs-refresh | Focuses: rest-api
---------------------------------------------------+-----------------------
Comment (by spacedmonkey):
I have been considering this ticket. I am not sure this ticket belongs in
core. If it had landed in core when the menu endpoint did, this would make
sense, but now block themes are more common, this menu endpoint is less
and less useful.
I am worried about any solution that requires opt-in would makes for lot
of duplicated code for developers. Lots of the following across many
codebases
{{{#!php
<?php
add_filter( 'menu_endpoint_public', '__return_true' );
}}}
My suggetion, we create a canonical plugin maintained by the REST API /
core team to make, menu, menu item and menu locations public endpoints. If
developers / users want to make this data public, they can install this
plugin / make it is a dependency to your theme / plugin.
I made a start on this plugin [https://github.com/spacedmonkey/menu-
endpoints-public here]. If the rest of the REST API team, I will look at
transfering the repo to the REST API github org and get this plugin on
repo.
Would love the throught of @TimothyBlynJacobs @kadamwhite @antonvlasenko
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54304#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list