Home › Forums › Backend Issues (wp-admin) › Don't show fields on Taxonomy 'add' form. › Reply To: Don't show fields on Taxonomy 'add' form.
add_filter('acf/location/rule_types', array($this, 'my_acf_location_rule_types'));
function my_acf_location_rule_types($choices) {
if (!isset($choices['Other'])) {
$choices['Other'] = array();
}
if (!isset($choices['Other']['post_level'])) {
$choices['Other']['taxonomy_form'] = 'Taxonomy Form';
}
return $choices;
}
add_filter('acf/location/rule_values/taxonomy_form', array($this, 'acf_location_taxonomy_form_values'));
function acf_location_taxonomy_form_values($choices) {
if (empty($choices)) {
$choices = array();
}
if (!isset($choices['taxonomy_list'])) {
$choices['taxonomy_admin'] = 'Taxonomy Admin List';
}
if (!isset($choices['taxonomy_list'])) {
$choices['taxonomy_edit'] = 'Taxonomy Term Admin';
}
return $choices;
}
add_filter('acf/location/rule_match/taxonomy_form', array($this, 'acf_location_taxonomy_form_match'), 10, 3);
function acf_location_taxonomy_form_match($match, $rule, $options) {
$current = 'taxonomy_admin';
if (isset($_GET['tag_ID'])) {
$current = 'taxonomy_edit';
}
switch ($rule['operator']) {
case '==':
$match = ($current == $rule['value']);
break;
case '!=':
$match = ($current != $rule['value']);
break;
default:
// do nothing
break;
}
return $match;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.