Menus: Fix the Custom Links text fallback.
When adding a Custom Link and leaving the "Link Text" field empty, WordPress used to set a default fallback text: "Menu Item". The changes in [36379] broke this behavior making the fallback text: ` (Pending)`, with a leading space. Pending major refactoring of the Menus page (which is going to use a block-based user interface) this change just restores the original behavior by adding the fallback text to the related AJAX response. Props christophherr, Fencer04, thakkarhardik, backermann1978, audrasjb. Fixes #38415. git-svn-id: https://develop.svn.wordpress.org/trunk@45727 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b1ccaf8903
commit
f82b40a2d2
@ -1430,6 +1430,7 @@ function wp_ajax_add_menu_item() {
|
|||||||
$menu_obj = get_post( $menu_item_id );
|
$menu_obj = get_post( $menu_item_id );
|
||||||
if ( ! empty( $menu_obj->ID ) ) {
|
if ( ! empty( $menu_obj->ID ) ) {
|
||||||
$menu_obj = wp_setup_nav_menu_item( $menu_obj );
|
$menu_obj = wp_setup_nav_menu_item( $menu_obj );
|
||||||
|
$menu_obj->title = empty( $menu_obj->title ) ? __( 'Menu Item' ) : $menu_obj->title;
|
||||||
$menu_obj->label = $menu_obj->title; // don't show "(pending)" in ajax-added items
|
$menu_obj->label = $menu_obj->title; // don't show "(pending)" in ajax-added items
|
||||||
$menu_items[] = $menu_obj;
|
$menu_items[] = $menu_obj;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user