WordPress.org

Make WordPress Core

Changeset 24235


Ignore:
Timestamp:
05/10/2013 06:03:09 PM (8 years ago)
Author:
SergeyBiryukov
Message:

Prevent menu items with '0' label from being removed on menu saving. props MikeHansenMe, kovshenin. fixes #23051.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/nav-menu.php

    r24214 r24235  
    8080        }
    8181
    82         $title = empty( $item->label ) ? $title : $item->label;
     82        $title = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label;
    8383
    8484        $submenu_text = '';
     
    12361236
    12371237            // Menu item title can't be blank
    1238             if ( empty( $_POST['menu-item-title'][$_key] ) )
     1238            if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' == $_POST['menu-item-title'][ $_key ] )
    12391239                continue;
    12401240
  • trunk/wp-includes/nav-menu.php

    r23941 r24235  
    337337        }
    338338
    339         if ( empty( $args['menu-item-title'] ) || $args['menu-item-title'] == $original_title ) {
     339        if ( $args['menu-item-title'] == $original_title )
    340340            $args['menu-item-title'] = '';
    341341
    342             // hack to get wp to create a post object when too many properties are empty
    343             if ( empty( $args['menu-item-description'] ) )
    344                 $args['menu-item-description'] = ' ';
    345         }
     342        // hack to get wp to create a post object when too many properties are empty
     343        if ( '' ==  $args['menu-item-title'] && '' == $args['menu-item-description'] )
     344            $args['menu-item-description'] = ' ';
    346345    }
    347346
Note: See TracChangeset for help on using the changeset viewer.