If your content is not time-oriented (such as when using WordPress in non-blog contexts), you may wish to remove the publication date from your posts since this information is not relevant and can give the impression that your older content is outdated.
1. The Manual Method
The “proper” way to do this would be to edit your theme and remove the code that displays the post dates.
- Backup your theme, just in case
- Go to “Appearance > Editor” and repeat the following steps for each of your theme’s PHP files
- Look for these function calls in your theme’s code:
the_date()
,echo get_the_date()
,the_modified_date()
, andthe_time()
- Surround the function calls with PHP comment markers (
/*
and*/
); here are some examples:<?php /*the_date();*/ ?> <?php /*the_date('F j, Y');*/ ?> <?php /*echo get_the_date();*/ ?> <?php /*the_modified_date();*/ ?> <?php /*the_modified_date('', 'Last modified ');*/ ?> <?php /*the_time( get_option('date_format') );*/ ?>
- You may want to remove other text surrounding the function call. For example, if your theme has this code…
<div>Published on <?php the_time( get_option('date_format') ); ?></div>
…and you replace it with this…
<div>Published on <?php /*the_time( get_option('date_format') );*/ ?></div>
…your theme will output “Published on,” but not the date. Deleting “Published on” from your theme file will remove it from your site. Just be aware that you may have to remove text like this from your theme files to get a clean-looking result.
- Click “Update File”
2. The Automatic Method
If you’re looking for a quick fix, just go to “Appearance > Editor” in your WordPress admin and add this code to your theme’s functions.php file. Put it at the top of the file, but after the opening <?php
line.
function jl_remove_post_dates() { add_filter('the_date', '__return_false'); add_filter('the_time', '__return_false'); add_filter('the_modified_date', '__return_false'); } add_action('loop_start', 'jl_remove_post_dates');
(Note: This method requires WordPress 3.0 or above)
Now check your site and verify that the post dates are gone. If they’re not, try replacing the code above with this more “aggressive” version:
function jl_remove_post_dates() { add_filter('the_date', '__return_false'); add_filter('the_time', '__return_false'); add_filter('the_modified_date', '__return_false'); add_filter('get_the_date', '__return_false'); add_filter('get_the_time', '__return_false'); add_filter('get_the_modified_date', '__return_false'); } add_action('loop_start', 'jl_remove_post_dates');
I want to sincerely thank you for this information!! I was able to use the Automatic method and the second code. All of the dates posted are gone! Now I just need to figure out how to remove Author section as well. Thanks again! I really appreciate it. 🙂
Thanks, John! The aggressive version worked perfectly, even all these years later.
Thank you, It was a quick fix, I commented out date since my problem was two dates appearing in meshtutors.com (post and modified date)
function jl_remove_post_dates() {
/*add_filter(‘the_date’, ‘__return_false’);*/
/*add_filter(‘the_time’, ‘__return_false’);*/
add_filter(‘the_modified_date’, ‘__return_false’);
/*add_filter(‘get_the_date’, ‘__return_false’);*/
/*add_filter(‘get_the_time’, ‘__return_false’);*/
add_filter(‘get_the_modified_date’, ‘__return_false’);
} add_action(‘loop_start’, ‘jl_remove_post_dates’);
That is the code I used.
THANK YOU AGAIN
Thank you very much for the tip. It worked.
Hi. Thanks for this – I know its a very old post now, but still relevant.
I had to use the more aggressive automatic approach, however i am left with something that now says “Written by admin on” – it has removed the date but left this line. How do I go about removing that?
thankyou. It was awesome that you heled.
I just tried the “aggressive” version, and got the result; thanks for sharing such a great tip.
I just tried the both automatic version, first one not worked but the “aggressive” version did. Thanks for sharing such a great post and make my life easy.
Perfectly working!
Thanks!
Hi John, would this method of removing date also remove the date appearing right in front in Google search result page? The contents in my blog post are evergreen and I do not want the date to appear in Google search result. It seems that I had already removed post date in my post but the published dates are still appearing in Google search.
Hope to hear from you. Thank you.
I personally tend to use functions.php to achieve this, as per your last example. It’ a nice way to keep everything in one place. If I need to customise something in greater depth, then a child theme is the better option if you didn’t build the current one. Great post, very informative!
Hi John,
Thanks! Works fine, the aggressive version on the Cubic Theme of wordpress. Thank you very very mutch.Finally i can move on to make the website without the stupid date.
Thank you John, the automatic ‘agressive’ method worked perfectly for me :-D.
Hi,
It worked well for me, thanks for this.
Is there also a way to remove the dates after some period of time? Like 6 months?
So the more aggressive method worked for me, but — I can’t make changes to the theme. When I change the header, for example, and press save, it appears to save, but leaving that page says the changes have not been saved.
For now, I am just deleting that text from the functions.php file in my child theme, and making the changes, and then replacing the text.
Works…. around.
Thanks.
Both methods are working! Thanks for sharing!
when i publish my pages , i can see pages dates also shows up in google
how can i stop showin up dates in google results
An oldie but a goodie! Really appreciate you sharing information like this, pub dates gone!
Hi, manual removing as well as wp meta and date remover and other plugins don’t work with urls containing date; dates still are in search result. What to do? I don’t want to change permalinks.