#41162 closed enhancement (duplicate)
More Flexibility With Navigation Menu Item Types
Reported by: | michael.ecklund | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.8 |
Component: | Menus | Keywords: | |
Focuses: | administration, template | Cc: |
Description
Currently, WordPress only supports 4 types of navigation menu items.
post_type
post_type_archive
taxonomy
custom
Which is fine if that's how it needs to be for now. However, since anyone who decides to create their own menu type, their links will ALWAYS default to "Custom Link". At a minimum can we at least get a filter to override the menu type label?
I've created my own section with a custom menu type. Now all of my links show up as "Custom Link". Which is confusing, because there's actually a section to add "Custom Links". My links are not "Custom Links". I'd like to be able to filter that label text (at a minimum).
Referring to ./wp-includes/nav-menus.php
Line 769; As of WordPress 4.8. Code block:
<?php else { $menu_item->type_label = __('Custom Link'); $menu_item->title = $menu_item->post_title; $menu_item->url = ! isset( $menu_item->url ) ? get_post_meta( $menu_item->ID, '_menu_item_url', true ) : $menu_item->url; }
Could just add a filter...
$menu_item->type_label = apply_filters( 'some-hook-name', __('Custom Link') );
I mean, if you're going to just default everything to custom
, at least provide some flexibility here...
Thanks!
Duplicated: https://core.trac.wordpress.org/ticket/41161