I can’t say for certain, but I’d wager that url_to_postid() is simply not a very fast function. You shouldn’t need to use it though, since the original post ID is available from $item:
if ( 'post' === $item->object ) {
$post_id = $item->object_id;
$thumbnail = get_the_post_thumbnail_url( $post_id );
}
Related Posts:
- Split up wp_nav_menu with custom walker
- Call custom field into menu item
- add span class inside wp_nav_menu link anchor tag
- Determine if a navigation item has children
- Add Page ID class to nav menu items
- Bar separated navigation by extending Walker_Nav_Menu
- Bar separated navigation by extending Walker_Page
- Custom Nav Walker sub-menu HTML construct
- `start_el` depth argument in custom nav walker always evaluates to zero
- Benefits of using Nav Walker?
- Use walker for specific menu, or avoid use of walker
- How to display dynamic content in start_lvl function
- Add custom text to menu
- has_children in custom nav_walker
- Adding post excerpt into navigation menu
- Use wp_nav_menu to display ALL pages
- Third level navigation class
- How to add a submenu toggle button inside all “li” elements that have a submenu?
- add span class and i tag inside wp_nav_menu link anchor tag
- Change an li class name in a wordpress custom menu walker
- Add within the output of
- Is this format possible with a custom Nav Walker class?
- walker – 0 level on submenu formatting
- Determine the last child of the parent menu WP Nav Walker
- Nav and logo loading each time causing menu to move JointsWP – Foundation 6
- Navigation doesn’t render when wp is hosted
- How do you add a around the second level of a Menu?
- Help with walker for nav
- How to remove dropdown from wp_nav_menu
- How Do I Add Images To Main Navigation Menu
- Walker menu not displaying at all
- Show children (sub-navigation) of active menu item only
- Adding a unique ID to each sub-menu
- Remove a class from a using Walker
- How to Add support for sub-menu item description in wordpress?
- wp_list_pages Hierarchical Help
- changing the labels inside appearance -> menus for some for the fields
- Costum walker with sub menu item count
- How do I add 3rd level of dropdowns to wp_nav_menu array?
- Help with WordPress Custom Nav Walker
- Why is my navigation in my onepage not working?
- Is it possible to get_the_post_thumbnail (Featured Image) inside a sprintf function?
- Can I now add a class in the anchor of my menu item with WordPress 5.4?
- What is inside in $item in start_el function in Walker_Nav_Menu class
- Multi-Level Nav Bar
- Adding additional html to the end of the root level in a custom nav walker
- Change markup for just 2nd list element in custom Walker menu
- Where to place a svg chevron down in my custom walker?
- Add active class to wp_nav_menu
- Output existing wp_nav_menu with a custom walker
- how to split vertical menu into two columns using walker nav menu
- Conditional Nav Menu Inside Nav Menu Across Multisite Sites
- How to add odd and even classes to all nav links through walker?
- Output sort number in wp menu list item?
- Creating custom Menu for custom theme
- Check in walker if current page is descendant
- Can’t add optional class to menu item when using Walker_Nav_Menu
- Add dynamic content block to nav section generated by custom walker
- Customize Walker_nav_menu to show posts if item is category
- Determine if a navigation item has children
- Walker for menus
- how to make a walker to this (in bootstrap, i try but not work)
- how can i get the page_ID in nav li [closed]
- Custom navigation / menu output (walker?)
- Nav walker bootstrap: Display 3rd level and 4th level in dropdown menu
- How to Add to Each Menu Link with link text to data-attr?
- Bootstrap dropdown nav pills not working with wp_nav_menu()
- Customizing a walker menu class
- How to add parent element’s title to nav menu’s child?
- Menus like a CMS
- Get top items number from wordpress menu
- Prev / Next menu item
- wp_nav_menu() with multiple Class
- Grey out nav buttons unless is_user_logged_in()
- How to approach this menu design?
- Trying to Create Menu in WordPress
- Sub Menu does not display using Nav Walker
- Get Menu Name inside walker
- WordPress Walker – Group two items?
- Where to implement custom walker class?
- Dynamic_sidebar inside wp_nav_menu
- Hide menu from homepage
- How to add a element with walker menu right after begin of the navigation tags?
- Custom menu walker – remove li tag based on class name
- How to add columns to wordpress menu editor
- how to insert data in li tag of navigation
- Current author archive in navigation menu
- Hide a menu (navigation bar) on all posts
- Need help with Walker_Nav_Menu class
- Bootstrap Nav Walker Sub Menu Image
- Header lists posts instead of showing primary nav menu
- Add parent link to its submenu
- Need direction on a seemingly complex menu walker for automatically inserting a parent link li in it’s submenu ul
- Show only second level menu items? [duplicate]
- Add item ONLY to the primairy navigation
- Image menu on responsive WordPress
- individual images as navigation design TwentyTen
- Navigation won’t update to show full path to single post
- Add a new menu selector element into WordPress nav-menus.php
- How to add toggle-able DOM element after nav menu item?