Create Taxonomy For a WordPress User

As we all know, “taxonomy” is a prominent feature provided by WordPress that we can allocate to a default post or custom post type. This feature is not available for the users. If you want to Create Taxonomy For a WordPress User, then this article is for you.

Prerequisites for this functionality
1) WordPress installed.
2) A theme where you can write the code in functions.php.
3) ACF plugin installed and activated.

If you have all the above, then let’s get started:

Step 1 – Register a Taxonomy

The first step is to register a taxonomy with any name. In our example, we will create a taxonomy with the name “user_category”. Add the following code to your active theme’s functions.php file.

Step 2 – Add admin menu

Now we have to add an admin menu item under the user page using “add_users_page” hook. Add the following code to your active theme’s functions.php file.

Up to here, your taxonomy is ready for WordPress users, but the problem is that when we will add a term, then this will activate the post menu from the left.

To fix this issue, add the following code to your active theme’s functions.php file.

 

Loading