WordPress.org

Make WordPress Core

Ticket #36212: 36212.5.diff

File 36212.5.diff, 763 bytes (added by audrasjb, 12 months ago)

Menus: Replace blank nav menu item titles with a non-breaking space

  • src/wp-admin/includes/nav-menu.php

    diff --git a/src/wp-admin/includes/nav-menu.php b/src/wp-admin/includes/nav-menu.php
    index 42d3607d23..62ee81dc96 100644
    a b function wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selecte 
    11801180        if ( ! empty( $_POST['menu-item-db-id'] ) ) {
    11811181                foreach ( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
    11821182
    1183                         // Menu item title can't be blank.
     1183                        // Menu item title can't be blank. Blank titles are replaced with a non-breaking space character.
    11841184                        if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' === $_POST['menu-item-title'][ $_key ] ) {
    1185                                 continue;
     1185                                $_POST['menu-item-title'][ $_key ] = ' ';
    11861186                        }
    11871187
    11881188                        $args = array();