WordPress.org

Make WordPress Core

Changeset 25285


Ignore:
Timestamp:
09/06/13 17:08:00 (8 months ago)
Author:
wonderboymusic
Message:

Use get_the_title() when dealing with post_type-like items in the admin.

Props nacin, DrewAPicture.
Fixes #14975.

File:
1 edited

Legend:

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

    r25209 r25285  
    5656        } elseif ( 'post_type' == $item->type ) { 
    5757            $original_object = get_post( $item->object_id ); 
    58             $original_title = $original_object->post_title; 
     58            $original_title = get_the_title( $original_object->ID ); 
    5959        } 
    6060 
     
    261261        $output .= '<input type="checkbox" class="menu-item-checkbox'; 
    262262        if ( property_exists( $item, 'front_or_home' ) && $item->front_or_home ) { 
    263             $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), $item->post_title ); 
     263            $title = sprintf( _x( 'Home: %s', 'nav menu front page title' ), get_the_title( $item->ID ) ); 
    264264            $output .= ' add-to-top'; 
    265265        } elseif ( property_exists( $item, 'label' ) ) { 
     
    267267        } 
    268268        $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> '; 
    269         $output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title ); 
    270         $output .= '</label>'; 
     269        if ( isset( $item->post_type ) ) 
     270            $output .= empty( $item->label ) ? esc_html( get_the_title( $item->ID ) ) : esc_html( $item->label ); 
     271        else 
     272            $output .= isset( $title ) ? esc_html( $title ) : esc_html( $item->title ); 
     273        $output .= '</label>'; 
    271274 
    272275        // Menu item hidden fields 
Note: See TracChangeset for help on using the changeset viewer.