Shortcode to show current post category with link
One way of doing it would be to modify your current code and add the links in there: function category_name_shortcode() { global $post; $post_id = $post->ID; $catName = “”; foreach((get_the_category($post_id)) as $category){ $catName .= ‘<a href=”‘ . get_term_link($category) . ‘”>’ . $category->name . ‘</a>, ‘; } return $catName; } add_shortcode( ‘post_category’, ‘category_name_shortcode’ ); But there’s … Read more