Skip to content

Commit 67ad855

Browse files
Merge pull request #37 from ellytronic/master
Add filters to allow devs to customize responses
2 parents c9d24a4 + f4e7768 commit 67ad855

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

wp-rest-api-v2-menus.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ function wp_api_v2_menus_get_all_menus() {
2626
}
2727
}
2828
}
29-
30-
return $menus;
29+
30+
return apply_filters('wp_api_v2_menus__menus', $menus);
3131
}
3232

3333
/**
@@ -48,7 +48,7 @@ function wp_api_v2_menu_get_all_locations() {
4848
$locations->{$location_slug}->menu = get_term( $menu_id );
4949
}
5050

51-
return $locations;
51+
return apply_filters('wp_api_v2_menus__locations', $locations);
5252
}
5353

5454
/**
@@ -82,7 +82,7 @@ function wp_api_v2_locations_get_menu_data( $data ) {
8282
}
8383
}
8484

85-
return $menu;
85+
return apply_filters('wp_api_v2_menus__menu', $menu);
8686
}
8787

8888
/**
@@ -199,7 +199,7 @@ function wp_api_v2_menus_get_menu_items( $id ) {
199199
}
200200
} while(count($child_items));
201201

202-
return array_values($menu_items);
202+
return apply_filters('wp_api_v2_menus__menu_items', array_values($menu_items));
203203
}
204204

205205
/**
@@ -239,7 +239,7 @@ function wp_api_v2_menus_get_menu_data( $data ) {
239239
}
240240
}
241241

242-
return $menu;
242+
return apply_filters('wp_api_v2_menus__menu', $menu);
243243
}
244244

245245
add_action( 'rest_api_init', function () {

0 commit comments

Comments
 (0)