You have to pass the values, not echo
them.
So something like this should work:
$post_cats = get_the_category();
$slugs = wp_list_pluck( $post_cats, 'slug' );
post_class( join( ' ', $slugs );
You have to pass the values, not echo
them.
So something like this should work:
$post_cats = get_the_category();
$slugs = wp_list_pluck( $post_cats, 'slug' );
post_class( join( ' ', $slugs );