• Ced

    (@cedriccharles)


    Hello ?? !

    First of all, thank you for this great plugin !

    I have a small issue here on one of my project : I have a CPT “product” with a custom taxonomy “brand” associated to it. I have activated SCPOrder for the CPT AND the taxonomy. When I use get_terms, it doesn’t work properly : If I don’t specify the ‘orderby’ argument, it shows the brand terms in the order they are in the admin (so drag and drop order is ok). But if I specify the ‘orderby’ argument to “name”, the terms are not ordered by name at all… Why is that ? With CPT, I can choose to order by name OR by menu_order… Not with custom taxonomies ?

    Here is my get_terms arguments :

    $taxonomy = 'brand';
      $cpt = 'product';
      $terms = get_terms($taxonomy, array(
        'orderby'     => 'name',
        'order'       => 'ASC',
        'hide_empty'  => false,
        'parent'      => 0,
        'meta_query' => array(
        	'relation' => 'OR',
          array(
            'key'       => 'brand_details_hide',
            'value'     => true,
            'compare'   => '!='
          ),
          array(
            'key'       => 'brand_details_hide',
            'compare'   => 'NOT EXISTS',
          ),
        ),
      ));

    Thank you in advance,
    Cédric

  • The topic ‘Not working properly with get_terms’ is closed to new replies.