Home › Forums › Backend Issues (wp-admin) › Hide Taxonomy Term fields on the main category page › Reply To: Hide Taxonomy Term fields on the main category page
Use a custom location rule that overrides the ACF location rule for taxonomy https://www.advancedcustomfields.com/resources/custom-location-rules/
// priority 20 runs after ACF built in filter
add_filter('acf/location/rule_match/taxonomy', 'acf_location_rules_match_taxonomy', 20, 3);
function acf_location_rules_match_taxonomy($match, $rule, $options) {
if ($rule['param'] == 'taxonomy' && !isset($_GET['tag_ID'])) {
// if the rule is for taxonomy but $_GET['tag_ID'] is not set
// then this is the main taxonomy page and not a term page
// set match to false
$match = false;
}
return $match;
}
I’m glad you brought this up, there are many times when I don’t want fields to show on this page and your question made me want to figure out how to do it.
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.