There’s a DB column being wasted for nav_menu_items and i was driving crazy because post_name was always returning a NUMBER! in my navigation menu items.
Then I found out SOME have a text-slug, and SOME DONT.
I don’t know why the oddity. I then figured out in the DB that the nav_menu_item is a “type” of post. So I removed the menu items, Created new ones (permalinks as /%postname%/) , new id numbers were assigned, and YET no slug.
Earlier, I already tried manually modifying the slug in the post editor, but the menu items have their own entry, and there seems to be no script to update them based on the post changes (page, not post)
I also tried a plugin to re-create the slugs… no success (it seems to work on the pages only, not the nav_menu_item type posts.
I’m out of ideas.
I need it to style the menu items with a different icon each, and I can’t rely on the ID to be always the same.
Is that a bug?
Should they update automatically?
How did some good post_names managed to get there correctly?
Ok, ite seems… that only the nav_menu_items pointing to manual links (not pages or posts) have a slug or a post title.
Let me guess. It was faster to leave unused all those DB fields (and keep them empty) out from the nav_menu_items than filtering existing queries and functions for post_type, to prevent naming conflicts with the real post, right?
…or was a custom icon for a menu item a scenario never imagined?
So… page named classes ( e.g. li.menuitem_post-title ) won’t be possible until the whole wordpress core be safe for distinguishing between the real post entry and a navigation item. :(, even when having the same post_name or post_title, right?
I tried to get the id of related post from the url, but the url for nav_menu_items is its own url, in the form of ?q=92, not the post’s, (although I’m using pretty permalinks) and entering that in the browser makes my blog answer with “page not found”. Is there a function to retrieve the relation between menu items and posts?
At least… where is it located!??
- The topic ‘Missing post_name (slug) in nav_menu_items -Bug?’ is closed to new replies.