Skip to content

Commit 071caf4

Browse files
Merge pull request #25 from Fifciu/feat/#24-thumbnail_src
It adds thumbnail src
2 parents 154e92f + 6c7d59b commit 071caf4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

wp-rest-api-v2-menus.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ function wp_api_v2_menus_get_menu_items( $id ) {
145145
// add slug to menu items
146146
$slug = basename( get_permalink($item->object_id) );
147147
$item->slug = $slug;
148+
if (isset($item->thumbnail_id) && $item->thumbnail_id) {
149+
$item->thumbnailSrc = wp_get_attachment_image_url($item->thumbnail_id, 'post-thumbnail');
150+
}
148151
} else if($item->type == 'taxonomy') {
149152
$cat = get_term($item->object_id);
150153
$item->slug = $cat->slug;

0 commit comments

Comments
 (0)