How to add publish date in the title

if the output you see is ABC [post_published], then it means your shortcode isn’t working as it should. try including following code at the end of inside your theme’s functions.php file.

function ppd_shortcode(){
  return get_the_date();
}
add_shortcode('ppdate', 'ppd_shortcode');

When you register a shortcode using the add_shortcode function, you pass in the shortcode tag ($tag) and the corresponding function ($func)/hook that will execute whenever the shortcut is used.

Important: When naming tags, use lowercase letters only, don’t use hyphens, underscores are acceptable.

In this case, the shortcut tag is ppdate and the hook is ppd_shortcode. you can use the shortcode as [ppdate]

  • note, if this didn’t work, try replacing return the_date(); with echo get_the_date();

Update: You said that your page title is working but meta title is still displaying wrong. Currently using Rank Math SEO, you can change the necessary page title as follows.

Go to Pages and select the page you want to edit. look for Page title SEO option, plugin has built in variables for you to use.