Home Forums Backend Issues (wp-admin) Hide taxonomy term in Form and in post


Hide taxonomy term in Form and in post

  • Hi,

    I have added an ACF checkbox for taxonomy term, checked equals HIDDEN.
    In ACF form and post edit page, i need to hide the term in Dropdown if the chekbox is checked.
    By the way i need also to hide all the post that have this taxonomy term.

    Post : Movie
    Taxonomy: Genre
    Taxonomy term : Action
    Action is Checked – > Hide “Action” in ACF form dropdown, edit movie page , and all the action movie in backend.


  • i have tried this, but it does no work:

    // exclude categories from category dropdown
    add_filter('acf/fields/taxonomy/query/name=materiel_client', 'exclude_categories', 10, 2);
    function exclude_categories( $args, $field ) {
      $terms = get_terms([
        'taxonomy' => 'materiel_client',
        'hide_empty' => false,
    $excluding = array();
     foreach ($terms as $term)
     // $temp.=get_field ( 'visibilite', $term->term_id  );
     if (get_post_meta( $term->term_id , 'visibilite')=='oui'){
     array_push($excluding , get_post_meta( $term->term_id , 'visibilite'));
       $args['exclude'] = $excluding; //the IDs of the excluded terms
      return $args;
  • actually get_field ( ‘visibilite’, $term->term_id ) is empty and also get_post_meta( $term->term_id , ‘visibilite’)

    the value is in databae :

  • You need to use

    get_field('visibilite', 'term_'.$term->term_id)


    get_field('visibilite', $term)


    get_term_meta($term->term_id, 'visibilite', true)
Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Hide taxonomy term in Form and in post’ is closed to new replies.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.