I figured it out. To get the selected category, I don’t need all the codes above. I just need the below.
$category = wp_get_object_terms( $post->ID, 'acadp_categories' );
$selected_category = $category[0]->name;
I figured it out. To get the selected category, I don’t need all the codes above. I just need the below.
$category = wp_get_object_terms( $post->ID, 'acadp_categories' );
$selected_category = $category[0]->name;