[wp-trac] [WordPress Trac] #54304: Expose menu data public in Menus REST API

WordPress Trac noreply at wordpress.org
Tue Jan 28 04:07:24 UTC 2025


#54304: Expose menu data public in Menus REST API
--------------------------------------------+---------------------------
 Reporter:  spacedmonkey                    |       Owner:  spacedmonkey
     Type:  enhancement                     |      Status:  closed
 Priority:  normal                          |   Milestone:  6.8
Component:  REST API                        |     Version:  4.7
 Severity:  normal                          |  Resolution:  fixed
 Keywords:  has-patch needs-testing commit  |     Focuses:  rest-api
--------------------------------------------+---------------------------
Changes (by spacedmonkey):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"59718" 59718]:
 {{{
 #!CommitTicketReference repository="" revision="59718"
 REST API: Introduce filter for controlling menu read access.

 The menu, menu item, and menu location endpoints were added to the REST
 API in [52079]. In that commit, menu data was treated as private and
 restricted to logged-in users with the edit_theme_options capability.
 However, in many cases, this data can be considered public. Previously,
 there was no simple way for developers to allow this data to be exposed
 via the REST API.

 This commit introduces the rest_menu_read_access filter, enabling
 developers to control read access to menus, menu items, and menu locations
 in the REST API. The same filter is applied across all three REST API
 classes, simplifying the process of opting into exposing this data.

 Each instance of the filter provides the current request and the relevant
 class instance as context, allowing developers to selectively or globally
 enable access to the data.

 Props spacedmonkey, antonvlasenko, kadamwhite, julianmar, masteradhoc.
 Fixes #54304.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54304#comment:27>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list