Check for WP_Error. Props ptahdunbar. fixes #12949

git-svn-id: https://develop.svn.wordpress.org/trunk@14599 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-05-13 16:34:14 +00:00
parent 580e82b661
commit 0a38355cce
1 changed files with 2 additions and 1 deletions

View File

@ -514,7 +514,8 @@ function wp_setup_nav_menu_item( $menu_item ) {
} elseif ( 'taxonomy' == $menu_item->type ) { } elseif ( 'taxonomy' == $menu_item->type ) {
$object = get_taxonomy( $menu_item->object ); $object = get_taxonomy( $menu_item->object );
$menu_item->type_label = $object->singular_label; $menu_item->type_label = $object->singular_label;
$menu_item->url = get_term_link( (int) $menu_item->object_id, $menu_item->object ); $term_url = get_term_link( (int) $menu_item->object_id, $menu_item->object );
$menu_item->url = !is_wp_error( $term_url ) ? $term_url : '';
$original_title = get_term_field( 'name', $menu_item->object_id, $menu_item->object, 'raw' ); $original_title = get_term_field( 'name', $menu_item->object_id, $menu_item->object, 'raw' );
$menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title; $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title;