add_filter( 'wp_nav_menu_objects', 'add_custom_menu_links', 10, 2 );
function add_custom_menu_links( $items, $args ) {

$new_links = array();

$label = 'Menu item'; // add your custom menu item content here

// Create a nav_menu_item object
$item = array(
'title' => $label,
'menu_item_parent' => 0,
'ID' => 'yourItemID',
'db_id' => '',
'url' => '',
'classes' => array( 'menu-item' )
);

$new_links[] = (object) $item; // Add the new menu item to our array

// insert item
$location = 1; // insert at 2rd place
array_splice( $items, $location, 0, $new_links );

return $items;
}

Advertisements