0
我正在編寫一個web服務,我需要在JSON響應中獲取所有類別的Wordpress列表。有人已經做到了嗎?請分享解決方案。從自定義查詢中獲取wordpress類別列表
我正在編寫一個web服務,我需要在JSON響應中獲取所有類別的Wordpress列表。有人已經做到了嗎?請分享解決方案。從自定義查詢中獲取wordpress類別列表
以下是json格式中所有類別列表的功能。我希望這將是work.Please試試這個: -
<?php
function get_all_categories(){
$args = array(
'type' => 'post',
'child_of' => 0,
'parent' => '',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
'hierarchical' => 1,
'exclude' => '',
'include' => '',
'number' => '',
'taxonomy' => 'category',
'pad_counts' => false
);
$categories = get_categories($args);
return json_encode($categories));
}
?>
感謝分享 –
@AliRaza歡迎:) –
請註明制約因素,如語言,系統等等 – MarshallOfSound