[wp-trac] [WordPress Trac] #41162: More Flexibility With Navigation Menu Item Types
WordPress Trac
noreply at wordpress.org
Sun Jun 25 16:42:14 UTC 2017
#41162: More Flexibility With Navigation Menu Item Types
--------------------------------------+-----------------------------
Reporter: michael.ecklund | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Menus | Version: 4.8
Severity: normal | Keywords:
Focuses: administration, template |
--------------------------------------+-----------------------------
Currently, WordPress only supports 4 types of navigation menu items.
1. `post_type`
2. `post_type_archive`
3. `taxonomy`
4. `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
<?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!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41162>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list