您将要使用get_terms
. 下面的代码显示了如何访问这些条款。请参阅Codex page for get_terms 有关可以发送到函数的参数的更多信息。我还显示了对象数组中返回的所有数据。
// Set your args
$args = array(
\'hide_empty\' => 0 // Show terms that are not associated with any posts
);
// Get the terms
$projects = get_terms(\'projects\', $args);
// Loop through and use terms
foreach($projects as $project)
{
echo \'Term ID \' . $project->term_id;
echo \'Name: \' . $project->name;
echo \'Slug: \' . $project->slug;
echo \'Term Group \' . $project->term_group;
echo \'Term Taxonomy ID: \' . $project->term_taxonomy_id;
echo \'Taxonomy: \' . $project->taxonomy;
echo \'Description \' . $project->description;
echo \'Parent: \' . $project->parent;
echo \'Count: \' . $project->count;
}