0
爲什麼此代碼無法使用當前的WordPress分類系統顯示分類名稱「Apple」?類別名稱存儲在$ wpdb-> terms表格(wp_terms)中。MySQL代碼無法顯示分類名稱(WordPress數據庫)
<?php
$ra_category_id = 3;
$ra_category = $wpdb->get_results("SELECT name FROM $wpdb->terms WHERE term_id = '3'");
$ra_category_name = $ra_category->name;
?>
<h3>Category: <?php echo $ra_category_name; ?></h3>
錶行是
term_id name slug term_group
1 Uncategorized uncategorized 0
2 Blogroll blogroll 0
3 Apples apples 0
4 Bananas bananas 0