• I’m trying to display the terms for a given taxonomy (disciplines).

    I want the terms to display without links, and in alphabetical order. Everything works correctly, except for the ordering. No matter what I try I cannot get the list to order alphabetically by name.

    This is the code

    <?php 
    
    $args = array(
    'orderby' => 'name',
    'order' => 'ASC'
    );
    
    $disciplines = wp_get_post_terms($post->ID, 'disciplines', $args);
    
    echo '<ul>';
    foreach($disciplines as $discipline){
      echo '<li>' . $discipline->name . '</li>';
    }
    echo '</ul>';
    
    ?>
  • The topic ‘Order by not working with wp_get_post_terms’ is closed to new replies.