0
我有以下查詢:WordPress的順序分類字母
<?php
$args = array(
'hide_empty' => false,
'orderby' => 'title',
'order' => 'DESC'
);
$terms = get_terms('projets-location', $args);
if (!empty($terms) && !is_wp_error($terms)){
foreach ($terms as $term) { ?>
<h5 id="<?php echo $term->slug; ?>" class="filter-menu-item" data-filter=".<?php echo $term->slug; ?>">
<strong><?php echo $term->name; ?></strong>
</h5>
<?php }
} ?>
這表明從projets地點分類的所有分類術語,我已經添加了排序依據及以上的訂單屬性但他們仍然選擇了不顯示按字母順序排列,我是愚蠢的她還是有什麼我會出錯?任何建議將不勝感激!
我嘗試這樣做,也沒有工作 – user1374796
@ user1374796,我測試過它,它爲我工作。兩種變體'orderby'=>'name'和'orderby'=>'標題'的作品都是正確的。你能否顯示術語名稱列表,這是你的代碼處理的結果? –