$menu_item->object_id = !
isset( $menu_item->object_id
) ?
get_post_meta( $menu_item->ID, '_menu_item_object_id', true
) :
$menu_item->object_id;
$menu_item->object = !
isset( $menu_item->object
) ?
get_post_meta( $menu_item->ID, '_menu_item_object', true
) :
$menu_item->object;
$menu_item->type = !
isset( $menu_item->type
) ?
get_post_meta( $menu_item->ID, '_menu_item_type', true
) :
$menu_item->type;
if ( 'post_type' ===
$menu_item->type
) { $object =
get_post_type_object( $menu_item->object
);
if ( $object ) { $menu_item->type_label =
$object->labels->singular_name;
// Denote post states for special pages (only in the admin).
if ( function_exists( 'get_post_states'
) ) { $menu_post =
get_post( $menu_item->object_id
);
$post_states =
get_post_states( $menu_post );
if ( $post_states ) { $menu_item->type_label =
wp_strip_all_tags( implode( ', ',
$post_states ) );
} } } else { $menu_item->type_label =
$menu_item->object;
$menu_item->_invalid = true;
} if ( 'trash' ===
get_post_status( $menu_item->object_id
) ) { $menu_item->_invalid = true;
}