{"id":1612,"date":"2006-02-08T22:29:43","date_gmt":"2006-02-08T22:29:43","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/wp-relativedate\/"},"modified":"2026-08-09T03:00:19","modified_gmt":"2026-08-09T03:00:19","slug":"wp-relativedate","status":"publish","type":"plugin","link":"https:\/\/fi.wordpress.org\/plugins\/wp-relativedate\/","author":259,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"2.0.0","stable_tag":"2.0.0","tested":"7.0.4","requires":"6.8","requires_php":"8.2","requires_plugins":null,"header_name":"WP-RelativeDate","header_author":"Lester 'GaMerZ' Chan","header_description":"","assets_banners_color":"0e1116","last_updated":"2026-08-09 03:00:19","external_support_url":"","external_repository_url":"","donate_link":"https:\/\/lesterchan.net\/site\/donation\/","header_plugin_uri":"https:\/\/lesterchan.net\/portfolio\/programming\/php\/","header_author_uri":"https:\/\/lesterchan.net","rating":3,"author_block_rating":0,"active_installs":100,"downloads":42979,"num_ratings":2,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.00":{"tag":"1.00","author":"GamerZ","date":"2007-03-17 07:26:00"},"1.00beta":{"tag":"1.00beta","author":"GamerZ","date":"2007-03-17 07:26:00"},"1.10":{"tag":"1.10","author":"GamerZ","date":"2007-03-17 07:26:00"},"1.11":{"tag":"1.11","author":"GamerZ","date":"2007-05-31 18:36:47"},"1.20":{"tag":"1.20","author":"GamerZ","date":"2007-09-30 08:17:48"},"1.30":{"tag":"1.30","author":"GamerZ","date":"2008-06-10 07:42:06"},"1.31":{"tag":"1.31","author":"GamerZ","date":"2008-07-18 03:17:41"},"1.40":{"tag":"1.40","author":"GamerZ","date":"2009-02-07 13:57:30"},"1.50":{"tag":"1.50","author":"GamerZ","date":"2009-06-08 11:08:06"},"1.51.1":{"tag":"1.51.1","author":"GamerZ","date":"2026-07-24 15:40:39"},"2.0.0":{"tag":"2.0.0","author":"GamerZ","date":"2026-08-09 03:00:19"}},"upgrade_notice":{"2.0.0":"<p>Requires WordPress 6.8 and PHP 8.2.<\/p>\n\n<p><strong>Relative dates will start appearing where they never did before.<\/strong> Since 1.20 the plugin hooked <code>the_date()<\/code> and <code>the_time()<\/code>, which almost no modern theme calls \u2014 every default theme since Twenty Nineteen builds its post meta from <code>get_the_date()<\/code> instead. The plugin now hooks the getters, so a theme that showed plain dates for years will show &quot;Today&quot; and &quot;3 days ago&quot; the moment you update. To switch it off for one template, see &quot;Turning It Off For One Template&quot; above.<\/p>\n\n<p><strong>If you had turned the plugin off for a template, the line has changed.<\/strong> <code>remove_filter( &amp;#039;the_date&amp;#039;, &amp;#039;relative_post_date&amp;#039;, 999 )<\/code> no longer removes anything; use <code>get_the_date<\/code>, and likewise <code>get_the_time<\/code> in place of <code>the_time<\/code>. The two comment filters are unchanged.<\/p>\n\n<p><strong><code>ago_only=&amp;quot;false&amp;quot;<\/code> now does what it says.<\/strong> Until 2.0.0 the shortcode read the string &quot;false&quot; as true, so <code>[relativedate ago_only=&amp;quot;false&amp;quot;]<\/code> printed only &quot;3 days ago&quot; instead of the date. Change those shortcodes to <code>ago_only=&amp;quot;true&amp;quot;<\/code> if you were relying on it.<\/p>\n\n<p><strong>Markup passed to <code>relative_post_the_date()<\/code> reaches the page again.<\/strong> Since 1.51.1 the tag escaped its own <code>$before<\/code> and <code>$after<\/code> arguments, so a theme passing `` got the literal characters printed.<\/p>\n\n<p>The plugin now stores one row, <code>wp_relativedate_version<\/code>, and deletes it on uninstall. There is still no settings screen, and no template tag or shortcode changed name.<\/p>"},"ratings":{"1":"1","2":0,"3":0,"4":0,"5":"1"},"assets_icons":{"icon.svg":{"filename":"icon.svg","revision":978084,"resolution":false,"location":"assets","locale":false}},"assets_banners":{"banner-1544x500.png":{"filename":"banner-1544x500.png","revision":3639535,"resolution":"1544x500","location":"assets","locale":"","width":1544,"height":500},"banner-772x250.png":{"filename":"banner-772x250.png","revision":3639535,"resolution":"772x250","location":"assets","locale":"","width":772,"height":250}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.00","1.00beta","1.10","1.11","1.20","1.30","1.31","1.40","1.50","1.51.1","2.0.0"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":3639037,"resolution":"1","location":"assets","locale":"","width":1280,"height":1190},"screenshot-2.png":{"filename":"screenshot-2.png","revision":3639037,"resolution":"2","location":"assets","locale":"","width":1000,"height":306}},"screenshots":{"1":"Every post date on the front page, written as how long ago it was","2":"The <code>relativedate<\/code> and <code>relativetime<\/code> shortcodes, in a post published minutes ago"}},"plugin_section":[],"plugin_tags":[1365,107,1358,1429,1356],"plugin_category":[44],"plugin_contributors":[77620],"plugin_business_model":[],"class_list":["post-1612","plugin","type-plugin","status-publish","hentry","plugin_tags-ago","plugin_tags-comments","plugin_tags-date","plugin_tags-relative","plugin_tags-time","plugin_category-discussion-and-community","plugin_contributors-gamerz","plugin_committers-gamerz"],"banners":{"banner":"https:\/\/ps.w.org\/wp-relativedate\/assets\/banner-772x250.png?rev=3639535","banner_2x":"https:\/\/ps.w.org\/wp-relativedate\/assets\/banner-1544x500.png?rev=3639535","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":"https:\/\/ps.w.org\/wp-relativedate\/assets\/icon.svg?rev=978084","icon":"https:\/\/ps.w.org\/wp-relativedate\/assets\/icon.svg?rev=978084","icon_2x":false,"generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/wp-relativedate\/assets\/screenshot-1.png?rev=3639037","caption":"Every post date on the front page, written as how long ago it was"},{"src":"https:\/\/ps.w.org\/wp-relativedate\/assets\/screenshot-2.png?rev=3639037","caption":"The <code>relativedate<\/code> and <code>relativetime<\/code> shortcodes, in a post published minutes ago"}],"raw_content":"<!--section=description-->\n<p>WP-RelativeDate rewrites your post and comment dates as how long ago they were: 'Today', 'Yesterday', '2 Days Ago', '2 Weeks Ago', '2 Hours Ago', '2 Minutes Ago', '2 Seconds Ago'.<\/p>\n\n<p>There is nothing to configure and no settings screen. WP-RelativeDate rewrites your post and comment dates as soon as it is activated, and leaves anything more than a month old, or from a previous year, exactly as your theme printed it.<\/p>\n\n<h3>Features<\/h3>\n\n<ul>\n<li>Post\/Comment Date\n\n<ul>\n<li>Today<\/li>\n<li>Yesterday<\/li>\n<li>X days ago<\/li>\n<li>X weeks ago<\/li>\n<\/ul><\/li>\n<li>Post\/Comment Time\n\n<ul>\n<li>X seconds ago<\/li>\n<li>X minutes ago<\/li>\n<li>X hours ago<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<h3>Donations<\/h3>\n\n<p>I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks, I will really appreciate it. If not feel free to use it without any obligations.<\/p>\n\n<h3>Usage<\/h3>\n\n<p>You need not do anything. WP-RelativeDate will automatically modify your post\/comment date or time display. No text will be added if the post or comment is more than a month old.<\/p>\n\n<h3>Examples<\/h3>\n\n<ul>\n<li>Post\/Comment Date\n\n<ul>\n<li>Today<\/li>\n<li>Yesterday<\/li>\n<li>10th January 2007 (2 days ago)<\/li>\n<li>25th January 2007 (2 weeks ago)<\/li>\n<\/ul><\/li>\n<li>Post\/Comment Time\n\n<ul>\n<li>21:10 (2 seconds ago)<\/li>\n<li>21:15 (5 minutes ago)<\/li>\n<li>22:15 (2 hours ago)<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<h3>Shortcodes<\/h3>\n\n<ul>\n<li><code>[relativedate]<\/code>\n\n<ul>\n<li><code>[relativedate date_format=\"jS F Y\" ago_only=\"false\"]<\/code><\/li>\n<\/ul><\/li>\n<li><p><code>[relativetime]<\/code><\/p>\n\n<ul>\n<li><code>[relativetime time_format=\"H:i\" ago_only=\"false\"]<\/code><\/li>\n<\/ul>\n\n<p>ago_only drops the date or time and leaves only the relative phrase. It accepts <code>true<\/code>\/<code>false<\/code>, <code>1<\/code>\/<code>0<\/code>, <code>yes<\/code>\/<code>no<\/code> and <code>on<\/code>\/<code>off<\/code>.<\/p><\/li>\n<\/ul>\n\n<h3>Template Tags<\/h3>\n\n<ul>\n<li><code>relative_post_the_date( $format, $before, $after, $ago_only, $display )<\/code> \u2014 a drop-in replacement for <code>the_date()<\/code>. <code>$before<\/code> and <code>$after<\/code> carry markup, exactly as they do in <code>the_date()<\/code>.<\/li>\n<\/ul>\n\n<h3>Turning It Off For One Template<\/h3>\n\n<p>The plugin has no settings screen. To leave a template's dates alone, remove the filter before the loop:<\/p>\n\n<pre><code>remove_filter( 'get_the_date', 'relative_post_date', 999 );\n<\/code><\/pre>\n\n<p>The four callbacks are <code>relative_post_date<\/code> on <code>get_the_date<\/code>, <code>relative_post_time<\/code> on <code>get_the_time<\/code>, <code>relative_comment_date<\/code> on <code>get_comment_date<\/code> and <code>relative_comment_time<\/code> on <code>get_comment_time<\/code>, all at priority 999.<\/p>\n\n<p>Removing the <code>get_the_date<\/code> filter also covers <code>the_date()<\/code>, which builds its output by calling <code>get_the_date()<\/code>. The same goes for <code>the_time()<\/code>, <code>comment_date()<\/code> and <code>comment_time()<\/code>.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Install and activate the plugin.<\/li>\n<\/ol>\n\n<p>That is the whole of it. There is no settings screen and nothing to configure: your post and comment dates are rewritten as soon as the plugin is active, and anything older than a month is left exactly as your theme printed it.<\/p>\n\n<!--section=faq-->\n<dl>\n<dt id=\"display%20relative%20date%20in%20every%20posts\"><h3>Display Relative Date in every posts<\/h3><\/dt>\n<dd><ul>\n<li>If you want to display Relative Date in every posts, use <code>relative_post_the_date()<\/code> instead of <code>the_date()<\/code> in your theme.<\/li>\n<\/ul><\/dd>\n<dt id=\"why%20did%20my%20theme%27s%20%60%3Ch2%3E%60%20around%20the%20date%20start%20showing%20up%20as%20text%3F\"><h3>Why did my theme's `` around the date start showing up as text?<\/h3><\/dt>\n<dd><ul>\n<li>That was a bug in 1.51.1, fixed in 2.0.0. <code>relative_post_the_date()<\/code> was escaping its own <code>$before<\/code> and <code>$after<\/code> arguments. Upgrading is the fix; no theme change is needed.<\/li>\n<\/ul><\/dd>\n<dt id=\"my%20post%20dates%20are%20still%20plain%20on%20a%20block%20theme\"><h3>My post dates are still plain on a block theme<\/h3><\/dt>\n<dd><ul>\n<li>This affects WordPress 6.9 and later only. From 6.9 the core Post Date block resolves the date through Block Bindings and formats it itself, without calling <code>get_the_date()<\/code> or offering a filter, so no plugin can change what it prints. On WordPress 6.8 that block still calls <code>get_the_date()<\/code> and relative post dates work on block themes too.<\/li>\n<li>Comment dates are unaffected on every supported version \u2014 the Comment Date block still calls <code>get_comment_date()<\/code>. Post dates also work normally on classic themes and anywhere a template calls <code>the_date()<\/code>, <code>get_the_date()<\/code>, <code>the_time()<\/code> or <code>get_the_time()<\/code>.<\/li>\n<li>To get a relative post date in a block template, use the <code>[relativedate]<\/code> shortcode or call <code>relative_post_the_date()<\/code> from a block pattern or template part.<\/li>\n<\/ul><\/dd>\n<dt id=\"i%20used%20%60ago_only%3D%22false%22%60%20and%20now%20the%20date%20is%20back\"><h3>I used `ago_only=\"false\"` and now the date is back<\/h3><\/dt>\n<dd><ul>\n<li><code>ago_only=\"false\"<\/code> has always been documented as meaning false, but until 2.0.0 the plugin read it as true. If you were relying on that, use <code>ago_only=\"true\"<\/code> to keep the ago-only output.<\/li>\n<\/ul><\/dd>\n<dt id=\"does%20the%20plugin%20store%20anything%20in%20my%20database%3F\"><h3>Does the plugin store anything in my database?<\/h3><\/dt>\n<dd><ul>\n<li>One row, and a tiny one. There is nothing to configure, so the plugin stores no settings at all - only <code>wp_relativedate_version<\/code>, which records the version last run so that an upgrade knows what it is upgrading from. Deleting the plugin from the Plugins screen removes it.<\/li>\n<\/ul><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h3>2.0.0<\/h3>\n\n<ul>\n<li>BREAKING: Requires WordPress 6.8 and PHP 8.2, up from 6.0 and 7.4.<\/li>\n<li>BREAKING: The post callbacks moved from <code>the_date<\/code>\/<code>the_time<\/code> to <code>get_the_date<\/code>\/<code>get_the_time<\/code>. If you opted a template out with <code>remove_filter( 'the_date', 'relative_post_date', 999 )<\/code>, name the getter instead.<\/li>\n<li>NEW: Restructured into <code>includes\/<\/code>, with the date and time calculations in a <code>WP_RelativeDate_Core<\/code> class.<\/li>\n<li>NEW: Added the <code>wp_relativedate_version<\/code> row, and an <code>uninstall.php<\/code> that deletes it on a single site and across a network.<\/li>\n<li>NEW: Added a PHPUnit test suite and GitHub Actions CI.<\/li>\n<li>CHANGED: The two shortcode callbacks are now methods on the <code>WP_RelativeDate<\/code> class. Shortcodes are removed by tag, so <code>remove_shortcode( 'relativedate' )<\/code> is unaffected.<\/li>\n<li>FIXED: Post dates now work on any theme using <code>get_the_date()<\/code> or <code>get_the_time()<\/code>, which is every classic theme since Twenty Nineteen. The plugin previously only hooked <code>the_date()<\/code> and <code>the_time()<\/code>, so it appeared to do nothing on most themes.<\/li>\n<li>FIXED: Comment dates now work on block themes. Core's Comment Date block passes the comment as an argument and never sets the global the plugin used to read.<\/li>\n<li>FIXED: <code>relative_post_the_date()<\/code> no longer escapes <code>$before<\/code> and <code>$after<\/code>, which had been rendering <code>&lt;h2&gt;<\/code> and friends as literal text since 1.51.1.<\/li>\n<li>FIXED: <code>ago_only=\"false\"<\/code> now means false. The documented spelling had always been read as true.<\/li>\n<li>FIXED: Post and comment dates no longer raise \"Attempt to read property on null\" when there is no post or comment in scope, which a recent-comments widget could trigger.<\/li>\n<li>FIXED: Content dated ahead of the server clock no longer renders \"(-300 seconds ago)\".<\/li>\n<li>FIXED: Removed <code>load_plugin_textdomain()<\/code>, which trips <code>_doing_it_wrong<\/code> on WordPress 6.7 and later.<\/li>\n<\/ul>","raw_excerpt":"Displays relative date alongside with your post\/comments actual date.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/fi.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/1612","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fi.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/fi.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/fi.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=1612"}],"author":[{"embeddable":true,"href":"https:\/\/fi.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/gamerz"}],"wp:attachment":[{"href":"https:\/\/fi.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=1612"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/fi.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=1612"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/fi.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=1612"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/fi.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=1612"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/fi.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=1612"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/fi.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=1612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}