Skip to content

Commit c37408e

Browse files
Merge pull request #22 from raik/master
Add custom post type archive slug support
2 parents 1783df2 + 1b56316 commit c37408e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

wp-rest-api-v2-menus.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ function wp_api_v2_menus_get_menu_items( $id ) {
148148
} else if($item->type == 'taxonomy') {
149149
$cat = get_category($item->object_id);
150150
$item->slug = $cat->slug;
151+
} else if($item->type == 'post_type_archive') {
152+
$post_type_data = get_post_type_object($item->object);
153+
154+
if ($post_type_data->has_archive) {
155+
$item->slug = $post_type_data->rewrite['slug'];
156+
}
151157
}
152158

153159
if ( $item->menu_item_parent ) {

0 commit comments

Comments
 (0)