Site icon Hip-Hop Website Design and Development

Shortcodes not working in category or tag description

when Yoast plugin is enabled shortcodes not working in category or tag description

I used this and this article and add these codes to the function but nothing change
please help me.

add_filter( ‘term_description’, ‘do_shortcode’ );
add_filter( ‘category_description’, ‘do_shortcode’ );
add_filter( ‘post_tag_description’, ‘do_shortcode’ );


function my_shortcode()
{
    ob_start();
    require_once(get_template_directory() . '/html/htmlcontent.php');
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
add_shortcode("shortcode","my_shortcode");

Update: When I use the below code everything fine. I don’t know whats the problem

function my_shortcode() {
    $url = get_template_directory() . '/html/my_shortcode.php';
    $content = file_get_contents($url);
    return $content;
}