Menü schliessen
Created: March 3rd 2021
Last updated: April 8th 2021
Categories: Advanced Custom Fields,  Php,  Wordpress
Author: Tim Fürer

WordPress Plugin: Advanced Custom Fields Custom Metabox for Custom Taxonomies

Tags:  ACF,  functions.php,  guide,  PHP,  wordpress
Donation Section: Background
Monero Badge: QR-Code
Monero Badge: Logo Icon Donate with Monero Badge: Logo Text
82uymVXLkvVbB4c4JpTd1tYm1yj1cKPKR2wqmw3XF8YXKTmY7JrTriP4pVwp2EJYBnCFdXhLq4zfFA6ic7VAWCFX5wfQbCC

In this short guide, I'll show you how to disable the default WordPress Metabox and create your own Custom Metabox for your Custom Taxonomies with Advanced Custom Fields.

A guide for creating Custom Post Types can be found here and one for creating Custom Taxonomies here and a short introduction to Advanced Custom Fields is linked here.

Disabling the WordPress default Metabox and why

This is the default Metabox:

WordPress screenshot Metabox

It allows the user to assign categories and even create new ones. The biggest problem with it is, that you can assign multiple categories. That is the main reason for disabling it.

To disable it, first, head into the functions.php file.

Then, add these arguments to your Custom Taxonomy:

'meta_box_cb' => false,
'show_in_quick_edit' => false

Creating your own Metabox with Advanced Custom Fields

By creating your own Custom Metabox, you have the freedom of choice to limit the user to only select a single category.

In your field group, create a new field and set it's type to "Taxonomy".

Next, select the Taxonomy this field should allow you to select categories from.

Assign the field group to your Custom Post and you're done.