• I use a shortcode generated by a plugin that displays the year, [y]. I want to use it in the title of a post/page, so I added to my functions.php the following code lines:

    // Execute shortcodes in post and meta title.
    add_filter(‘the_title’, ‘do_shortcode’);
    add_filter(‘wp_title’, ‘do_shortcode’);

    As result, the shortcode is displayed well in the title included in the content area, but not in the title meta tag, where it shows up as [y] (I’ve checked the source code where appears also [y] as well). How can I solve the issue so that the shortcode to be displayed in the head meta tag/code source of the page?

  • The topic ‘Shortcode in head/title tag’ is closed to new replies.