I have lots of posts where I have current month with the post title.

When month ends, it’s kind of annoying to change all the posts manually. So, I created a shortcode to show the current month.

I used add_filter( 'the_title', 'do_shortcode' ); to execute the shortcode in title. It all works fine.

Problem is, in the meta title, the raw shortcode is showing instead of the output.

Any suggestions how I can work it out.

Thanks in advance.

1 Answer
1

The filter for the title is single_post_title, you can do the same thing you do with the_title:

add_filter( 'single_post_title', 'do_shortcode' );

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *