Skip to content

Commit 85df628

Browse files
authored
Use post_name instead of basename (Bugfix for static home page)
Fixes Bug when setting a static front-page. Context on localhost: When setting a static frontpage `basename( get_sl($item->object_id) )` returns "localhost". Using `et_post_field( 'post_name', $item->object_id )` returns the actual slug of the page.
1 parent f835c0c commit 85df628

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

wp-rest-api-v2-menus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ function wp_api_v2_menus_get_menu_items( $id ) {
157157

158158
if($item->type == 'post_type') {
159159
// add slug to menu items
160-
$slug = basename( get_permalink($item->object_id) );
160+
$slug = get_post_field( 'post_name', $item->object_id );
161161
$item->slug = $slug;
162162
} else if($item->type == 'taxonomy') {
163163
$cat = get_term($item->object_id);

0 commit comments

Comments
 (0)