You are using the get_the_terms()
but this function is used to get the custom taxonomies.
Use the function get_the_category();
inside the WordPress loop and pass the get_the_ID()
function which will get the current post ID in the loop.
get_the_category(get_the_ID());
<?php
$args = array(
'post_type' => 'work',
'posts_per_page' => '9'
);
$work_loop = new WP_Query( $args );
if ( $work_loop->have_posts() ) :
while ( $work_loop->have_posts() ) : $work_loop->the_post();
// Set variables
$cat_ids = get_the_ID();
$cat_names_array = get_the_category($ids);
$work_category = get_the_category( get_the_ID() );
$work_title = get_field( 'work_title' );
$work_main_image = get_field( 'work_main_image' );
$work_link = get_field( 'work_title' );
$work_about = get_field( 'work_about' );
// $work_category = get_the_terms( the_post()->ID, 'taxonomy' );
// Output
?>
<a href="https://wordpress.stackexchange.com/questions/245303/<?php echo $work_main_image["url']; ?>" class="single_item link <?php foreach ( $work_category as $key => $value) { echo $value->category_nicename . " "; } ?> col-md-4 col-sm-6 wow fadeInUp" data-wow-delay="0.3s">
<img src="https://wordpress.stackexchange.com/questions/245303/<?php echo $work_main_image["url']; ?>" alt="">
</a>
<?php
endwhile;
wp_reset_postdata();
endif;
?>
Cheers 🙂