Make WordPress Core

Opened 9 years ago

Last modified 3 months ago

#40860 new defect (bug)

Post that is "Pending Review" and Scheduled shows incorrect "Last Modified" date in Post Listing

Reported by: yearginsm Owned by:
Priority: normal Milestone: Future Release
Component: Posts, Post Types Version:
Severity: normal Keywords: good-first-bug has-test-info has-patch has-unit-tests
Cc: Focuses: administration

Description

Reproduction steps:

  1. Create a new post
  2. Schedule the post for a date in the future
  3. Set the status to "Pending Review"
  4. Save the post
  5. Return to Posts listing
  6. Observe that the "Date" column has an incorrect "Last Modified" flag

Attachments (4)

Screen Shot 2017-05-24 at 10.17.43 PM.png (33.3 KB ) - added by yearginsm 9 years ago.
Settings on Post
Screen Shot 2017-05-24 at 10.17.43 PM.2.png (33.3 KB ) - added by yearginsm 9 years ago.
Posts Listing
Screen Shot 2017-05-24 at 10.16.56 PM.png (17.6 KB ) - added by yearginsm 9 years ago.
Posts Listing
40860.patch (678 bytes ) - added by pratikgandhi 9 years ago.
To display the time of the modified post

Download all attachments as: .zip

Change History (12)

#1 @karmatosed
9 years ago

  • Component GeneralPosts, Post Types
  • Keywords needs-patch added
  • Milestone Awaiting ReviewFuture Release
  • Priority normallow

Good find. I can replicate it just showing the date. As this screenshot shows, the saved post shows a different thing.

https://cldup.com/McNEGkecob.png

I do agree it should be consistent, either way. My advice would be to show time ago like a saved post.

Last edited 9 years ago by karmatosed (previous) (diff)

@pratikgandhi
9 years ago

To display the time of the modified post

#2 @pratikgandhi
9 years ago

  • Focuses accessibility added; ui removed
  • Keywords has-patch added; needs-patch removed

I have added the patch to show the post modified date when the post status is draft or pending review.

This ticket was mentioned in Slack in #accessibility by afercia. View the logs.


9 years ago

#4 @afercia
9 years ago

  • Focuses accessibility removed

This ticket was mentioned in Slack in #core by sirlouen. View the logs.


12 months ago

#6 @SirLouen
12 months ago

  • Keywords needs-patch good-first-bug has-test-info added; has-patch removed
  • Priority lownormal
  • Version 4.7.5

Reproduction Report

Description

✅ This report validates that the issue can still be reproduced.

Environment

  • WordPress: 6.9-alpha-60093-src
  • PHP: 8.2.29
  • Server: nginx/1.29.1
  • Database: mysqli (Server: 8.4.6 / Client: mysqlnd 8.2.29)
  • Browser: Chrome 140.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Twenty-Five 1.3
  • MU Plugins: None activated
  • Plugins:
    • AAA Testing Dolly
    • Health Check & Troubleshooting 1.7.1
    • Micro Email Testing 1.0.0
    • Test Reports 1.2.0

Testing Instructions

  • The ones provided in the OP

Actual Results

  1. ✅ Error condition occurs (reproduced).

Additional Notes

  • The patch is not applying anymore, and the code has change a bit and its not valid anymore this solution. Some other solution should be rethought. I'm going to clean all kw, to have a more recent version after 8 years.

This ticket was mentioned in PR #10059 on WordPress/wordpress-develop by @levinbaria.


12 months ago
#7

  • Keywords has-patch added; needs-patch removed

When rendering the Date column for posts in the list table, this patch changes the behavior
so that:

  • For published posts, the column shows the publication date/time (as before).
  • For non-published posts (draft, pending, scheduled, etc.), the column shows the post's last modified date/time.

Trac ticket: https://core.trac.wordpress.org/ticket/40860

This ticket was mentioned in PR #12246 on WordPress/wordpress-develop by @micahele.


3 months ago
#8

  • Keywords has-unit-tests added

## Summary

Fixes #40860.

The Posts list table Date column labels non-published posts as "Last Modified" but displays the post_date instead of the modified date. For a pending or draft post with a future publication date, this results in a *future* date being shown under a "Last Modified" label — which is incorrect and confusing.

### Reproduction

  1. Create a new post
  2. Schedule it for a date in the future
  3. Set its status to *Pending Review*
  4. Save, then return to the Posts list
  5. The Date column shows the future date labeled "Last Modified"

Verified on the local Docker environment:

post_date (future): 2026-06-27   post_modified (now): 2026-06-20
BEFORE: Last Modified 2026/06/27 at 11:00 pm   (wrong — future date)
AFTER:  Last Modified 2026/06/20 at 11:00 pm   (correct — actual modified date)

## The fix

In WP_Posts_List_Table::column_date(), for statuses other than publish and future, display the modified date/time (via get_the_modified_time() and get_post_timestamp( $post, 'modified' )) so the date shown matches the "Last Modified" label. Published and scheduled posts continue to show the publication date as before.

## Testing

Adds unit tests to Tests_Admin_wpPostsListTable:

  • test_column_date_shows_modified_date_for_pending_scheduled_post — asserts the modified date (not the future publication date) is shown for a pending+scheduled post. Fails without the fix, passes with it.
  • test_column_date_uses_publication_date_for_published_and_scheduled (data provider: published, scheduled) — asserts published/scheduled posts still show the publication date and correct label.
npm run test:php -- --filter test_column_date
✔ Column date shows modified date for pending scheduled post
✔ Column date uses publication date for published and scheduled with data set "published post"
✔ Column date uses publication date for published and scheduled with data set "scheduled post"
OK (3 tests, 7 assertions)
  • PHP lint: clean
  • PHPCS: no new errors/warnings on the changed lines

This builds on the approach proposed in the earlier patch on the ticket, adding unit test coverage (the ticket previously had has-test-info but no automated tests).

Note: See TracTickets for help on using tickets.