@@ -57,6 +57,7 @@ public function register_routes() {
57
57
'methods ' => WP_REST_Server::READABLE ,
58
58
'callback ' => array ( $ this , 'get_menus ' ),
59
59
'permission_callback ' => '__return_true ' ,
60
+ 'schema ' => array ( 'deprecated ' => true ),
60
61
)
61
62
) );
62
63
@@ -65,10 +66,11 @@ public function register_routes() {
65
66
'methods ' => WP_REST_Server::READABLE ,
66
67
'callback ' => array ( $ this , 'get_menu ' ),
67
68
'permission_callback ' => '__return_true ' ,
68
- 'args ' => array (
69
- 'context ' => array (
70
- 'default ' => 'view ' ,
71
- ),
69
+ 'schema ' => array ( 'deprecated ' => true ),
70
+ 'args ' => array (
71
+ 'context ' => array (
72
+ 'default ' => 'view ' ,
73
+ ),
72
74
),
73
75
)
74
76
) );
@@ -78,6 +80,7 @@ public function register_routes() {
78
80
'methods ' => WP_REST_Server::READABLE ,
79
81
'callback ' => array ( $ this , 'get_menu_locations ' ),
80
82
'permission_callback ' => '__return_true ' ,
83
+ 'schema ' => array ( 'deprecated ' => true ),
81
84
)
82
85
) );
83
86
@@ -86,6 +89,7 @@ public function register_routes() {
86
89
'methods ' => WP_REST_Server::READABLE ,
87
90
'callback ' => array ( $ this , 'get_menu_location ' ),
88
91
'permission_callback ' => '__return_true ' ,
92
+ 'schema ' => array ( 'deprecated ' => true ),
89
93
)
90
94
) );
91
95
}
@@ -98,7 +102,7 @@ public function register_routes() {
98
102
* @return array All registered menus
99
103
*/
100
104
public static function get_menus () {
101
-
105
+ _wp_rest_menus_doing_it_wrong ( __METHOD__ );
102
106
$ rest_url = trailingslashit ( get_rest_url () . self ::get_plugin_namespace () . '/menus/ ' );
103
107
$ wp_menus = wp_get_nav_menus ();
104
108
@@ -133,7 +137,7 @@ public static function get_menus() {
133
137
* @return array Menu data
134
138
*/
135
139
public function get_menu ( $ request ) {
136
-
140
+ _wp_rest_menus_doing_it_wrong ( __METHOD__ );
137
141
$ id = (int ) $ request ['id ' ];
138
142
$ rest_url = get_rest_url () . self ::get_plugin_namespace () . '/menus/ ' ;
139
143
$ wp_menu_object = $ id ? wp_get_nav_menu_object ( $ id ) : array ();
@@ -226,7 +230,7 @@ private function has_children( $items, $id ) {
226
230
* @return array All registered menus locations
227
231
*/
228
232
public static function get_menu_locations ( $ request ) {
229
-
233
+ _wp_rest_menus_doing_it_wrong ( __METHOD__ );
230
234
$ locations = get_nav_menu_locations ();
231
235
$ registered_menus = get_registered_nav_menus ();
232
236
$ rest_url = get_rest_url () . self ::get_plugin_namespace () . '/menu-locations/ ' ;
@@ -262,7 +266,7 @@ public static function get_menu_locations( $request ) {
262
266
* @return array The menu for the corresponding location
263
267
*/
264
268
public function get_menu_location ( $ request ) {
265
-
269
+ _wp_rest_menus_doing_it_wrong ( __METHOD__ );
266
270
$ params = $ request ->get_params ();
267
271
$ location = $ params ['location ' ];
268
272
$ locations = get_nav_menu_locations ();
@@ -401,8 +405,6 @@ public function format_menu_item( $menu_item, $children = false, $menu = array()
401
405
return apply_filters ( 'rest_menus_format_menu_item ' , $ menu_item );
402
406
}
403
407
404
-
405
408
}
406
409
407
-
408
410
endif ;
0 commit comments