From 7b457460010eca82310e58b4acd911a4483cf599 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Sat, 3 Aug 2019 12:19:56 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@45727 git-svn-id: http://core.svn.wordpress.org/trunk@45538 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 1 + wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 75c36e6068..5eafaf81a8 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -1430,6 +1430,7 @@ function wp_ajax_add_menu_item() { $menu_obj = get_post( $menu_item_id ); if ( ! empty( $menu_obj->ID ) ) { $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_items[] = $menu_obj; } diff --git a/wp-includes/version.php b/wp-includes/version.php index ca7cd50cf0..1df3186aab 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-45726'; +$wp_version = '5.3-alpha-45727'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.