Automatically Show Today’s Date in WordPress
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our W3Make Forum to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
You can add the current date in WordPress post title by following these steps:
1. Log in to your WordPress website and go to Appearance > Theme Editor.
2. From the Theme Files list on the right, select functions.php.
3. Add the following code at the end of the file:
“`
function add_date_to_title( $title, $post_id ) {
if ( is_single() ) {
$date = get_the_date();
$title = $date . ‘ – ‘ . $title;
}
return $title;
}
add_filter( ‘the_title’, ‘add_date_to_title’, 10, 2 );
“`
4. Click the Update File button to save the changes.
After completing these steps, the current date will be added to the beginning of the post title on single post pages.