Get custom taxonomy for visual composer shortcode but not working?
I created a shortcode for visual composer to get terms of a custom taxonomy. But when I get them (for a category dropdown on visual composer's backend editor) it's not working.
My code:
$args1= array(
‘taxonomy’ = ‘danh_muc’, **// my custom taxonomy**
‘hide_empty’ = 0,
);
$inra=array();
$danhmucs= get_terms($args1);
foreach ($danhmucs as $danhmuc) {
$tendm=$danhmuc- name;
$iddm=$danhmuc- term_id;
$inra[$tendm]=$iddm;
}
vc_map( array(
“name” = __(“News”, ‘understrap’),
“base” = “tintuc”,
“class” = “”,
“category” = ‘Content’,
“icon” = “icon-wpb-application-icon-large”,
“params” = array(
array(
“type” = “dropdown”,
“holder” = “div”,
“class” = “”,
“heading” = “Danh mục”,
“param_name” = “cat”,
“value” = $inra, //**array taxonomy by name= id**
“description” = ‘Chọn danh mục BĐS cần hiện bài đăng’,
),
)
));
But when I change ‘taxonomy’ => ‘danh_muc’ to ‘taxonomy’ => ‘category’ it's working fine!
I var_dump $inra with 2 cases: ‘taxonomy’ => ‘danh_muc’ and ‘taxonomy’ => ‘category’, The results are the same.
Thanks all!
Topic shortcode custom-taxonomy Wordpress
Category Web