Make WordPress Core

Changeset 18426


Ignore:
Timestamp:
07/11/2011 07:03:04 PM (13 years ago)
Author:
nacin
Message:

Check for WP_Error return values when using get_term_field() to set up nav menu items. fixes #17958 for trunk.

Location:
trunk
Files:
2 edited

Legend:

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

    r18277 r18426  
    5555        if ( 'taxonomy' == $item->type ) {
    5656            $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' );
     57            if ( is_wp_error( $original_title ) )
     58                $original_title = false;
    5759        } elseif ( 'post_type' == $item->type ) {
    5860            $original_object = get_post( $item->object_id );
     
    172174
    173175                <div class="menu-item-actions description-wide submitbox">
    174                     <?php if( 'custom' != $item->type ) : ?>
     176                    <?php if( 'custom' != $item->type && $original_title !== false ) : ?>
    175177                        <p class="link-to-original">
    176178                            <?php printf( __('Original: %s'), '<a href="' . esc_attr( $item->url ) . '">' . esc_html( $original_title ) . '</a>' ); ?>
  • trunk/wp-includes/nav-menu.php

    r18277 r18426  
    606606
    607607                $original_title = get_term_field( 'name', $menu_item->object_id, $menu_item->object, 'raw' );
     608                if ( is_wp_error( $original_title ) )
     609                    $original_title = false;
    608610                $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title;
    609611
Note: See TracChangeset for help on using the changeset viewer.