get_all_category_ids for bookmark
Вопрос
I was wondering how to create a list of categories name and ids for Wordpress Bookmarks such as get_all_category_ids
for post.
I tried using the get_bookmarks
, but the category does not appear in it.
Update:
Based on advice from @Mridul-Aggarwal, I wrote code that might be useful:
<?php
$tautan=get_terms('link_category');//get links category object
$html="<ul>\r\n";//Init
/*Looping*/
foreach($tautan as $isi) {
$nama=$isi->name;
$id=$isi->term_taxonomy_id;
$html.="\t<li>$id - $nama</li>";
};
$html.="</ul>\r\n";
/*Output*/
echo $html;
?>
Решение
what about get_terms('link_category');
?
Once you have the objects, you can use them to get whatever information you like.
Другие советы
I believe you want wp_list_categories
or get_categories
. The latter will return an array that you can use to create and format links however your like.
The function get_bookmark() exists, which also returns the category IDs in an array, for the ID of the bookmark passed.
Не связан с wordpress.stackexchange