We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7eda45d commit 1783df2Copy full SHA for 1783df2
wp-rest-api-v2-menus.php
@@ -140,9 +140,15 @@ function wp_api_v2_menus_get_menu_items( $id ) {
140
$child_items = [];
141
// pull all child menu items into separate object
142
foreach ( $menu_items as $key => $item ) {
143
- // add slug to menu items
144
- $slug = basename( get_permalink($item->object_id) );
145
- $item->slug = $slug;
+
+ if($item->type == 'post_type') {
+ // add slug to menu items
146
+ $slug = basename( get_permalink($item->object_id) );
147
+ $item->slug = $slug;
148
+ } else if($item->type == 'taxonomy') {
149
+ $cat = get_category($item->object_id);
150
+ $item->slug = $cat->slug;
151
+ }
152
153
if ( $item->menu_item_parent ) {
154
array_push( $child_items, $item );
0 commit comments