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

59 Comments

  1. SAC

    Thank you for this short guide… I tried the automatic method and it works without a problem.

  2. JRum

    I tried the automatic fix, but it did not work (it resulted in some strange text appearing at the top margin of the website). I have restored the text back to normal, but perhaps I am pasting the text in the wrong place. When I tried it the first time I pasted it at the very top of the text file before any other text. Should I be pasting it somewhere else in the text box? The functions.php box starts with the following text:

    <?php
    /**
    * TwentyTen functions and definitions
    *
    * Sets up the theme and provides some helper functions. Some helper functions
    * are used in the theme as custom template tags. Others are attached to action and
    * filter hooks in WordPress to change core functionality.

    Thanks

  3. Grace Qi

    My “appearance” menu doesn’t have an “edit” option. It has themes, widgets, menus, background, header, custom design, iPad, extras, and nothing else. How do I find this mysterious theme editor? (I’m using this theme 2010)

    • It sounds like your blog is running on a WordPress multisite setup. If you’re using WordPress.com or another multisite network that’s owned by someone else, editing themes won’t be an option. If you’re running your own multisite setup, you’ll have to go to Network Admin to find the theme editor.

      • Glo

        What’s “multisite setup?”
        I don’t have “editor” in “Appearances.” I’ve tried changing the code and fooling around with no real experience in what I’m doing, but nothing saves. Obviously, MY version is idiot-proofed. : )
        This Word Press stuff is a mystery. I don’t understand the different types – the difference between the free version and the templates for purchase. And they don’t really want to tell us…

        If they could be clear about what I’m getting, I’d make the choice to upgrade/purchase/buy hosting/whatever/add on all the stuff that costs more money in order to get what I want. But they don’t say what you’re getting until you bought it and it doesn’t meet your expectations.

        I’m super cautious now. By the time I’m done throwing down the credit card, I could have had a ‘real’ website for what I spent.

  4. Is it possible to remove date information only from meta description of the page and still show it on the page?

    • Yes. The date information shows up in the meta description because your theme marks up your posts as hEntry objects. There should be a <div> with the “hentry” class surrounding each post, and another <div> with the “hfeed” class surrounding the post list. I haven’t tested it myself, but as far as I know, removing those classes should remove the date info from your meta descriptions.

  5. Jackie

    I tried it and got this error…

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘__return_false’ was given in /home3/healthcl/public_html/fmg/blog/wp-includes/plugin.php on line 166

  6. Sean Armstrong

    Great suggestion and works well for me. I have no programming experience and experimented by adding a couple of extra lines of code in there. this allowed me to remove the author and title as well as the date and time.

    function jl_remove_post_dates() {
    add_filter(‘the_date’, ‘__return_false’);
    add_filter(‘the_author’, ‘__return_false’);
    add_filter(‘the_title’, ‘__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_author’, ‘__return_false’);
    add_filter(‘get_the_title’, ‘__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’);

  7. When publishing content that is time-oriented I use static pages. Nevertheless, information on alternative approaches is always appreciated. I’ll file it away for future use. Thanks.

  8. stefan

    Hi John, nice site you have. And thanks for helping us out with these handy articles.

    I tried to turn of the date for my wp site. I got it fixed with the more “aggressive” version. The one above didn’t work. But I have a (maybe stupid) question: is it possible to turn of the Published | By admin notice on my site?

    please have a look: bloemistinamsterdam (dot) nl didn’t put a link, don’t want it to be indexed yet.

    Hope you can help!

    thanks,
    Stefan

  9. Mahesh

    hey, @stefan your question is not stupid at all.because i also need this fix and i think everyone will need it because you don’t want to show “published on” since you don’t want the date at all. :)

    PS:thanks for this function but if can also remove the published on with function then it would be great!

  10. IH

    Hi John,

    great post. It helped me a lot.

    A little warning to you readers, if you want to modify the default theme it is better to copy it and use this copied version.

    Otherwise, WordPress will overwrite your modified default theme during an update.

    Thanks

  11. Conny

    Hi John,

    I used your automatic method (the aggressive version) to delete dates from my word press blog. Unfortunately I accidentally forgot to copy the last few characters ); of the code and now the entire website/admin-area is not working anymore. Do you have any idea how to fix it? I cannot open the website at all…

    Looking forward to hearing from you soon!
    Conny

  12. Baba

    Hey John

    Thanks for great post …

    I want to remove dates from certain category ..How can i do that ? :)I just found following line in loop-single.php “sprintf(esc_attr__( ‘View all posts by %s’, ‘unspoken’ ), get_the_author() ), get_the_author()), get_the_date(),”

    Lemme know what code i need to add. Would be great help to me :)

    Baba

  13. I used the more aggressive method and it still says “posted on” but the date has been removed. Anyway to remove the post “posted on”

  14. galaxie

    Mvcrews and others: Locate the code I’ve pasted below in your functions page – it should be just above the get the date, get the time, etc. Just delete where it says “posted on”

    function twentyeleven_posted_on() {
    printf( __( ‘ Posted on %4$s by %7$s‘, ‘twentyeleven’ ),

  15. Fred

    Thank you for this nice tutorial.
    I’m a beginner and I don’t have much aknoledge about coding, but it is clear and easy to follow tutorial.
    By the way, I’d like to remove the date from one post only, not from all posts as the tuto points. So, how could we remove a given post’s date?

    Thank you

  16. IT.tg

    Thank you….I tried the automatic method and it works without a problem.

  17. Hi John,
    I am looking to remove the search box from under the header so I can have the menu continue across the page not make a second line. (using twenty eleven)

    Regards

    Gary

  18. I am using Atahualpa but I can’t seem to figure how to remove the date and time. Can you help?

  19. Miracle

    May I ask you a question?
    Have you ever tried to use do_shortcode function in admin page or menu page?
    I found it is not work when using it in that situation.
    Could u do me a favor?

  20. Ali Zari

    Worked For me also thanks

  21. I used your aggressive code running on WordPress 3.3.1 with the Thesis theme and it worked great!!!
    Thanks,
    Oleg

  22. Jethro

    The Automatic Method Works without a problem. Thanks a lot…

  23. bartoli

    I personally redefined the function that displays the ‘posted on’ of my parent theme in my child theme’s functions.php to an empty function. In my case, the function was twentyeleven_posted_on() for my theme that is a child of twentyeleven. I find it more clean, since i don’t modify official themes, and who knows if those dates functions are not used for something else

  24. William Veasley

    John: thanks for the simple guide. I thought it was going to be much harder or that I would have to find a different theme, but thanks again your a life saver! ( :

    Best wishes,
    William Veasley

  25. Ruby

    You are a legend!

  26. Alex

    Thanks man! The maunuel method worked great. Keep up the good work and God bless!

  27. cp

    Thanks! The auto method works!

  28. Karan Chopra

    Thanks it works well for me too :)

  29. Kat

    Hi I tried the automatic method & also tried to put in extra categories following the pattern and like John (above tried) to get rid of the “posted on”. However I am now getting:

    Parse error: syntax error, unexpected T_STRING in /home/content/13/9242813/html/Christmas/wp-content/themes/admired/functions.php on line 10

    I repasted the original information back into the function php but it won’t accept it and now I can’t access any of the dashboard, theme or editing pages, all clicks lead back to the error page.

    I’d be grateful for any help you could give me in restoring my blog (or at least my access to it)!

    Kat

  30. Is there a way to do this if we don’t upgrade? I am using a free version.

  31. The more aggressive version worked perfect for the Genesis Theme. Thanks so much!

  32. Awesome recipes

    Thank you very much, i remove my date so easy. Thank you thank you

  33. Very nice. The first method did not work for me but the second more aggressive method did work. Pasted at the top of the functions file as you explained. I am using the Genesis Framework with the Outreach theme and most current version of Word Press. Not even sure which one but I keep it updated. Thanks again very much for your help! Worked like a charm and only took a second to copy and paste.

  34. Paul

    Thanks for this tips! I remove on one our project date

  35. inka

    Thank u so much for the automatic method. I tried everything ppl posted and nothing worked. I already wanted to give up but then I found your post. THANK YOU!!!!

  36. the aggressive works. now just have to figure out how to remove who it was posted by and the category that it was posted under.

  37. WST

    Hi John, I had to remove the post date on wordpress but on a different theme, I found the .php file that the post was using and searched for date within the file, then used your method of /* */ within the line of code () it worked first time! I found fix to be excellent and in the code it is very clean and easy to apply, thank you very much

  38. Yes pretty much right. It will remove the date from all post. thanks.

  39. The automated method worked instantly. Awesome tips. Thank you.

  40. Tried your auto method. Now I only get a funky on the top of my wordpress blog. No content shows any longer. Am I ever scared that I messed up my whole website. I can log into my site in wordpress, but this is what I see:

    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’);

    What happened to my content?

    Clarification – My website shows, but I cannot get into my WordPress to alter the website.

    HELP!! Please HELP!!

    Thanks.
    Jo

    • You need to put the code after the opening <?php line. I’m sorry that the instructions weren’t clear on that. I’ve updated the post to clarify that the <?php line needs to come first.

      If you can’t get into WordPress to edit the file, you’ll need to use an FTP program (such as FileZilla) to download it to your computer, where you can edit it, and then use the FTP program to re-upload it.

    • You need to put the code after the opening <?php line. I’m sorry that the post wasn’t more clear on this. I’ve updated the post to clarify that the <?php line needs to come first.

      If you can’t get into WordPress to edit the file, you should be able to edit it using an FTP program or by going into your web host’s control panel.

  41. Thank you, John, for this useful post. I’ve been wanting to do this for awhile. You’ve made it simple.

    Terrific site you have here. I’m looking forward to reviewing more of your fine work!

    TJ

  42. Mohi Uddin

    Hey John,
    nice site you have. And thanks for helping us out with these handy articles. I’m very greatfull to you.

  43. Armando Morales

    This worked wonderfully. Thanks.

  44. Cee

    Hi John!

    Wow..been looking forever for info. Have succeeded in removing dates/time from other blog, and used a plug in on this one. BUT…CANNOT get the time/date removed from the comments.

    They show up as links and thinking that maybe they are in archives, even though I don’t use the archive feature on the blog.

    I looked through code…eliminated all I could find that might be pertinent on functions, single etc. But NOTHING works. I am NOT adept at code..but did it to remove on posts before. But this Comment ‘link’ date’time
    is a real bugger.

    I tried BOTH of your codes at the top of functions. NO go. Tried adding other wording, like archives, comments..etc in the code. No Go.

    Do you have any advice or code I can paste in to get these dang time/date stamps off the comments?

    Thanks so much…awaiting breathlessly with crossed fingers! :-0

    Cee

  45. Balaji

    thank you very much

  46. 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 *

  47. chaz

    Thanks for this!!! It worked perfectly

  48. abdou

    the method 2 workes as a charm :0)

    thank you so much

  49. 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.

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>