Get custom taxonomy for visual composer shortcode but not working?

enter image description here

I created a shortcode visual composer get post by custom taxonomy. But when I get all custom taxonomy (for dropdown category on visual backend editor) it 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 working fine !
I var_dump careful $inra with 2 cases: ‘taxonomy’ => ‘danh_muc’ and ‘taxonomy’ => ‘category’, The results are the same
Thanks all !

Read more here: Get custom taxonomy for visual composer shortcode but not working?

Leave a Reply

Your email address will not be published. Required fields are marked *