2

I want to create a taxonomy that is related to the users, therefore I'd like to show the taxonomy under "Users" menu within wordpress admin. In codex there's a mention that you can attach taxonomy to "nav_menu_item" but I can't find any working example of how this works. If I use:

register_taxonomy( 'expertise', array( 'nav_menu_item' ), $args );

or

register_taxonomy( 'expertise', array( 'users' ), $args );

it doesn't work.

Any help would be much appreciated.

0

Take a look here if you want to code:

http://justintadlock.com/archives/2011/10/20/custom-user-taxonomies-in-wordpress

There are also plugins inspired by that post. Also, a massive open source plugin that goes even further is Groups:

https://github.com/itthinx/groups

| improve this answer | |
-1

The register_taxonomy function is designed only for adding taxonomies to existing post types and custom post types. It's not something that can be expanded to users.

I have just tried a couple of plugins that work with taxonomies and neither are able to attach a taxonomy to a user.

from http://codex.wordpress.org/Function_Reference/register_taxonomy :

Usage

<?php register_taxonomy( $taxonomy, $object_type, $args ); ?>

$object_type (array/string) (required) Name of the object type for the taxonomy object. Object-types can be built-in Post Type or any Custom Post Type that may be registered.

Builtin Post Types:

  • post

  • page

  • attachment
  • revision
  • nav_menu_item.

Custom Post Types:

  • {custom_post_type} - Custom Post Type names must be all in lower-case and without any spaces.

  • null - Setting explicitly to null registers the taxonomy but doesn't associate it with any objects, so it won't be directly available within the Admin UI. You will need to manually register it using the 'taxonomy' parameter (passed through $args) when registering a custom post_type (see register_post_type()), or using register_taxonomy_for_object_type().

| improve this answer | |
  • Two things: #1: What exactly the "nav_menu_item" will do? #2: In the end it's enough for me to show the taxonomy UI under the Users menu, it doesn't have to be attached to users. – wyktor Nov 30 '14 at 11:56
  • The nav_menu_item is the menu items you can create under a menu group. For example, at the top of this page is the menu: Questions, Tags, Users, Unanswered and Ask a Question. These items are a type of post-type. I'm not exactly sure how you'd use a taxonomy on a menu item, but you do have the option of doing it. – Madivad Nov 30 '14 at 14:45

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.