[wp-trac] [WordPress Trac] #61842: Uncaught TypeError in /wp-json/wp/v2/menu-items REST API POST operation

WordPress Trac noreply at wordpress.org
Mon Oct 7 09:55:06 UTC 2024


#61842: Uncaught TypeError in /wp-json/wp/v2/menu-items REST API POST operation
-------------------------------------------------+-------------------------
 Reporter:  mlf20                                |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  REST API                             |     Version:  6.2.2
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests reporter-   |     Focuses:  rest-api
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by ecomzones):

 Check Data Format
 Ensure that the data you're sending matches the expected format for the
 REST API endpoint /wp-json/wp/v2/menu-items. Each field in the request
 body should adhere to the expected type, which can be found in the
 WordPress REST API documentation.

 For example:

 title: should be a string
 menu_order: should be an integer
 url: should be a string
 An array where a string is expected will lead to an error. Here’s an
 example of a correctly formatted request:

 {{{
   "title": "My Menu Item",
   "url": "/my-menu-item-url",
   "menu_order": 1,
   "type": "custom"

 }}}

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


More information about the wp-trac mailing list