Wordpress在帖子上设置分类法?

hello this is my code to select taxonomy for post by post id.

this is my code and this code is doesn't work please help.

wp_set_post_terms( '2653', array('Bus'), 'category_type_bus');

this is my code when i run that code.and then after checked in backend. the Bus is not selected please tell where i am wrong.

thank you.

I feel you are missing one more parameter which is option. You can try to pass true so that it can append to existing.

try something like that

wp_set_post_terms( '2653', array('Bus'), 'category_type_bus',true);

if above things not work than try to pass the term id instead of name. something like this

wp_set_post_terms( '2653', array( 5 ), 'category_type_bus',true);