How to Remove Dates from WordPress Posts

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.

  1. Backup your theme, just in case
  2. Go to “Appearance > Editor” and repeat the following steps for each of your theme’s PHP files
  3. Look for these function calls in your theme’s code: the_date(), echo get_the_date(), the_modified_date(), and the_time()
  4. 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') );*/ ?>
  5. 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.

  6. 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');

88 Comments

1 2
  1. I got the date and time off, but the little word “on” appears after the author name where the date used to appear after it. How the devil do I get rid of it? It says “by Rita Reimers on” now. Looks ugly. thanks!

  2. Maria

    thank you this was very helpful!

  3. The aggressive method worked like a charm. THANKS!

  4. I have used the second aggressive method and worked fantastic. Thanks. I have tried to modify the settings of the wordpress theme that I am using, but still did not manage. The first automatic php script did not do it for me either, but the second hit the spot. I am using a domain name from one company, and a host from another, maybe this information may help someone else.

  5. Linda

    Hi John,

    thanks very much for the code above – worked brilliantly. I’ve been trying to remove the date from posts only in one specific category, and have been trying to modify/add to your code to do this, but am getting nowhere – any help would be hugely appreciated.

    thanks,

    Linda

  6. I made the changes but it wasn’t working so I would like to restore to the original settings and get back to square one. Any tips would be supremely appreciated. ;) Here is what is coming up on my page now: Parse error: syntax error, unexpected ‘*’ in /home/content/22/10344522/html/wp-content/themes/clean-retina-pro/functions.php on line 3

    • If you can’t access your WP admin interface, here’s what to do:

      1. Using an FTP program (like FileZilla) or your webhost’s file management interface, navigate to /wp-content/themes/
      2. Rename the folder of your current theme. This will make WordPress revert to the default theme.
      3. Login to the WP admin interface and use the Theme Editor to remove the code you added.
      4. Use the FTP program / file manager to rename the theme’s folder back to what it was.
      5. Go back to the WP admin interface and activate your theme again.

      Based on the error message, it sounds like you may have deleted a slash before the asterisk on line 3. Line 3 should be /* but it may have gotten turned into just *

  7. chaz

    Thanks for this!!! It worked perfectly

  8. Thanks for the tutorial Jane, just removed the time stamp from my blog. A tech blog covering long lasting content should definitely remove time stamps, whereas Gadgets Blog it’s the first thing.

  9. Lionel

    Thank you so much for this guide. It worked perfectly!

  10. James

    Hi John,

    Is there a way to remove ONLY the time and not the date?

    Thanks,
    James

  11. abdou

    the method 2 workes as a charm :0)

    thank you so much

  12. Dear John,

    I’m trying to remove the admin text and posted time from the categories on my site. Just go to the homepage and you will see. I’ve tried all of the above but it doesn’t seem to work. I am completely new to this so maybe I misread or something. Can you please check and let me know? I only want the pictures with the name of the category on the site, nothing beneath.

    Cheers.

  13. RAchel

    entered it where you suggested and the whole screen is white and won’t let me see ANYTHING. :(

    • It sounds like something got messed up when you pasted the code in. Perhaps you pasted it in the wrong spot, or accidentally changed something else in the code. But whatever the cause, it should be an easy fix:

      1. Using an FTP program (like FileZilla) or your webhost’s file management interface, navigate to /wp-content/themes/
      2. Rename the folder of your current theme. This will make WordPress revert to the default theme.
      3. Login to the WP admin interface and use the Theme Editor to remove the code you added.
      4. Use the FTP program / file manager to rename the theme’s folder back to what it was.
      5. Go back to the WP admin interface and activate your theme again.

  14. Max

    Hello,

    After removing the post-date and creating an excerpt for a blog post, will this excerpt also be displayed in Google’s SERP (with the date removed)?

    Thanks.

  15. For those wondering if a first-published date showing at the start of your page description will affect your ranking in Google; IT MOST CERTAINLY CAN – and not in a good way!

    Google SERP’s started showing the first-published date at the front of our description about 1 month ago.
    Obviously a date from 2009 will immediately repel anyone looking to buy online in 2013!

    Good grief; Myers started their business MUCH earlier than 2009, but their stores are every bit as relevant for shoppers today – as when they first started (maybe even more so).

    It’s a much different story online:
    Our home page promptly dropped from #7 on the first page of Google search results, to #25 – on the 3rd page.

    Understandably; our sales immediately dropped to almost zero.

    Forget about any worthwhile advice from Matt Cutts – that’s like asking a girl’s father if he knows the easiest way to get into his daughter’s pants.

    Never ceases to amaze me the people who hang on this guy’s every word for SEO advice.

    Wake up folks – HE WORKS FOR GOOGLE!
    Matt Cutts is first and foremost a spin-doctor, and a very good one at that.

    Google wants ecommerce sites like ours to PAY for clicks, because that’s where 80% of their profit comes from.

    If I sound cynical- YOU BET!
    You think this sort of thing by Google is accidental?

    Because we are selling a very niche market product; if we were forced to rely solely on adwords to get traffic, we may as well close shop. (We’ve tried it: any profits simply get all eaten up by the hungry Google monster)

    We have experimented with many things to eliminate that date; we get rid of it for a few days, and our website slowly comes back up in the search results. Next thing the $#@^&! date is back – and we slide back a page or 2 in the search results again. Been a yo-yo like this now (in Google) for well over a 1 month.

    All this time our ranking in Bing and Yahoo have remained unchanged; #3 & 4 on the first page.
    But you are never going to succeed online without also getting Google’s favour.

    This code from John in our php.functions file is a desperate last-ditch attempt; to get rid of googlebots extremely aggressive use of the date in our home page description.

    We have been running this web-based business for nearly 8 years, but recent algorithm changes by the bigG have got us disillusioned to the point of packing up and going back to a bricks & mortar business.

    What search engine genius at Google made this decision: it is more important to direct somebody looking for a bidet, to a blog called ‘Bidet Mate’ (a fat lady who paints and has feelings) rather than to a legitimate store selling bidets?

  16. @ John Lamansky,

    How do you get that little clock face to show at the start of your date?
    It’s SO much cooler than siff & boring- Last Updated:

  17. boris

    if Johns method does not work, try this one:

    1. Using an FTP program (like FileZilla) or your webhost’s file management interface, navigate to /wp-content/themes/
    2. Rename the folder of your current theme. This will make WordPress revert to the default theme.
    3. Login to the WP admin interface and DELETE the theme you were using
    4. Reinstall the same theme

  18. Thanks a lot John, it works great!

  19. Beatrice

    Thank you so much! Do you have any idea how I can remove ” Posted by admin”, No comments” and “Comments are closed”?

    Beast regards, Beatrice

  20. Hi John,

    Been wanting to do this for ages and came across your article. Thanks, the more aggressive piece of coding did the trick for the date and time. However it has left behind the unnecessary little clock symbol where the date stamp was – see here on a blog post http://www.tompollockphoto.com/blog/ and when you read the full post by clicking the more tag the post credit is showing as expected.

    I tried editing the code to get rid of the credit as commented below by Sean Armstrong but this didn’t work on my theme (Albedo by GraphPaperPress). Any ideas or should I try contacting GraphPaperPress directly.

    Thanks in advance,

    Tom

  21. Thank you for the tip. I tried the automatic one but didn’t work. The aggressive one worked though, and as you had said it would show posted on in the function.php file. I just had to alter the printf section and that did the work.

  22. Yeliz

    The “aggressive” version of the Automatic Method works. Thank you very much :)

  23. George

    Any suggestions on how to remove the link on the date and time for comments?

  24. Thanks john, this post worked for me and you saved my time :)

  25. Tried the automatic method. So easy and works perfect! Thank you.

  26. 1.000.000 Thanx!!! It works!!!!

  27. RJ

    Thanks so much for the assist on removing the post dates! It worked perfectly. And, it was much more direct that the solution offered by the theme author!

1 2

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>