You can use get_the_category_list()
, which returns a list of categories assigned to the post (each category in the list links to the category archive):
printf(
'<span class="posted-on">last updated on %1$s</span><span class="byline"> <i class="fa fa-user"></i> %2$s</span> in %3$s',
sprintf(
'<a href="https://wordpress.stackexchange.com/questions/338246/%1$s" rel="bookmark">%2$s</a>',
esc_url( get_permalink() ),
$time_string
),
sprintf(
'<span class="author vcard"><a class="url fn n" href="https://wordpress.stackexchange.com/questions/338246/%1$s">%2$s</a></span>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_html( get_the_author() )
),
get_the_category_list( ', ' )
);