2

I have a custom post type "packages" with a taxonomy "Celebrations" that has a few terms in it.

When I try to add a link to my wp nav menu through Appearance > Menus and choosing the term I want from the Celebrations meta box, the item shows up red with a title "(Invalid)".

See here for what I'm seeing: http://screencast.com/t/cyGF0cJU8

Has anyone else had this problem before?

I used Custom Post Type UI to register the post type and taxonomies originally with no other problems. After this happened, I tried disabling that plugin and registering them manually, but to no avail.

I've taken a look at the wp core to see what makes this come up and this is what I found: includes/nav-menu.php L595 in wp_setup_nav_menu_item()

elseif ( 'taxonomy' == $menu_item->type ) {
            $object = get_taxonomy( $menu_item->object );
            if ( $object ) {
                $menu_item->type_label = $object->labels->singular_name;
            } else {
                $menu_item->type_label = $menu_item->object;
                $menu_item->_invalid = true;
            }

All of the meta data for the menu item appears to be there: http://screencast.com/t/0hHQmObsQAT

Any help is greatly appreciated as always!

  • Please try the same with a custom registration (via code) instead and see if you still can reproduce the problem. – kaiser Nov 26 '15 at 11:39
1

Yeah I found the answer an another website. Taxonomies have a restriction that they cannot have uppercase characters in their name they can only have lowercase and underscore characters. that`s the problem.

0

I had the same problem, and it turned out to be a duplicate link that was already in the menu structure elsewhere. At least, that's my best guest why it was invalid. :-)

See also the source code here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.