• Hi guys,

    I am running a dynamic year shortcode on my site using this code in functions php:

    function year() {
    return date("Y");
    }
    add_shortcode("year", "year");
    add_filter( 'the_title', 'do_shortcode' ); // activate shortcode in WP Title
    add_filter( 'wpseo_title', 'do_shortcode' ); // activate shortcode in Yoast Title

    It works in the content, title, meta-desc etc…but, if i Use it in a heading in my content, the short does not get converted when shown in the table of content using the toc shortcode.

    So my question is – how can i make [year] shortcode run and show as current year in the table of contents as well?

    Right now i just shows ad [year] and not “2019” like in the rest of the content.

    Thanks!

    The page I need help with: [log in to see the link]

  • The topic ‘Running dynamic year-shortcode in TOC’ is closed to new replies.