/**
* Returns the menu formatted to edit.
*
* @since 3.0.0
*
* @param int $menu_id Optional. The ID of the menu to format. Default 0.
* @return string|WP_Error The menu formatted to edit or error object on failure.
*/
function wp_get_nav_menu_to_edit( $menu_id = 0
) { $menu =
wp_get_nav_menu_object( $menu_id );
// If the menu exists, get its items.
if ( is_nav_menu( $menu ) ) { $menu_items =
wp_get_nav_menu_items( $menu->term_id, array
( 'post_status' => 'any'
) );
$result = '<div id="menu-instructions" class="post-body-plain';
$result .= ( !
empty( $menu_items ) ) ? ' menu-instructions-inactive">' : '">';
$result .= '<p>' .
__( 'Add menu items from the column on the left.'
) . '</p>';
$result .= '</div>';
if ( empty( $menu_items ) ) { return $result . ' <ul class="menu" id="menu-to-edit"> </ul>';
}