the_category(); function is not allowing to direct change tags and attributes, get_the_category(); function return categories of posts in array so we can modify with custom html tags and attributes check out the below example code, its used in under loop of #the_loop.
//Get categories $the_postid; $categories = get_the_category($the_postid); if(is_array($categories)){ echo '<ul class="col-md-8 post-categories nlrp">'; foreach($categories as $postcat){ $category_id = get_cat_ID( $postcat->name ); $category_link = get_category_link( $category_id); echo '<li><a rel="category" href="'.esc_url($category_link).'">'.$postcat->name.'</a></li>'; } echo '</ul>'; }