custom = get_post_meta( $menu_item->ID, '_menu_item_custom', true ); return $menu_item; } add_filter( 'wp_edit_nav_menu_walker', 'custom_nav_edit_walker', 10, 2 ); function custom_nav_edit_walker($walker,$menu_id) { return 'Walker_Nav_Menu_Edit_Custom'; } /** * Copied from Walker_Nav_Menu_Edit class in core * * Create HTML list of nav menu input items. * * @package WordPress * @since 3.0.0 * @uses Walker_Nav_Menu */ class Walker_Nav_Menu_Edit_Custom extends Walker_Nav_Menu { /** * @see Walker_Nav_Menu::start_lvl() * @since 3.0.0 * * @param string $output Passed by reference. */ function start_lvl(&$output, $depth = 0, $args = array()) { } /** * @see Walker_Nav_Menu::end_lvl() * @since 3.0.0 * * @param string $output Passed by reference. */ function end_lvl(&$output, $depth = 0, $args = array()) { } /** * @see Walker::start_el() * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param object $args */ function start_el(&$output, $item, $depth = 0, $args = array(), $current_object_id=0) { global $_wp_nav_menu_max_depth; $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; ob_start(); $item_id = esc_attr( $item->ID ); $removed_args = array( 'action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce', ); $original_title = ''; if ( 'taxonomy' == $item->type ) { $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' ); if ( is_wp_error( $original_title ) ) $original_title = false; } elseif ( 'post_type' == $item->type ) { $original_object = get_post( $item->object_id ); $original_title = $original_object->post_title; } $classes = array( 'menu-item menu-item-depth-' . $depth, 'menu-item-' . esc_attr( $item->object ), 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive'), ); $title = $item->title; if ( ! empty( $item->_invalid ) ) { $classes[] = 'menu-item-invalid'; // translators: %s: title of menu item which is invalid $title = sprintf( '%s ' . __( '(Invalid)', 'vh' ), $item->title ); } elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) { $classes[] = 'pending'; // translators: %s: title of menu item in draft status $title = sprintf( '%s ' . __('(Pending)', 'vh'), $item->title ); } $title = empty( $item->label ) ? $title : $item->label; ?>