Opened 6 years ago
Last modified 2 years ago
#46609 new defect (bug)
Incorrect posts date on saving scheduled posts draft
Reported by: | Marlimant | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.1 |
Component: | Date/Time | Keywords: | |
Focuses: | Cc: |
Description
Hello:
When a scheduled post is saved, the created post date is keept, instead of the scheduled date the user wanted to program. So, when the user make a preview of the post, the date showed is incorrect, because not correspond to the scheduled post date but to the present date.
The date is corrected only when the post is programmed. I think the date of the post must be changed when the post was saved as a draft too.
Best regards,
Javier.
Change History (8)
#2
@
6 years ago
Yes. For example:
- I write a new post.
- I set the date of that post to 3 days later.
- Then I "Save" the post (not program it).
- Finally I make a preview of the saved post, and the front page not show the 3 days later post date. The date showed is today post, and I beleve it is incorrect. The date showed must be that I previously established to 3 days later.
#3
@
6 years ago
I am not sure the preview is meant to be 100% accurate representation of how site will look when draft is published. I think it's mostly for checking post content.
Do you know what code exactly in theme is responsible for output you think should be corrected?
#4
@
6 years ago
Well, the preview name is clear "pre-view", and the date is an important part of the post content, especially in a newspaper page, for example. In my case, I need to print a PDF version of the post before it be published, to then, I need to put a link to the user, who will can download the print version of the file later, when the post was published.
In that case, the saved preview version must show the established date to the post (for example, 20 minutes or 2 days forward), and not the date when the post was saved, which is irrelevant.
The date code of my page is (my page is in spanish)
<?php the_time('j \d\e\ F \d\e\ Y \|\ G:i a'); ?>
but the same occur with a native theme using:
twentyseventeen_time_link()
I don't know if that codes was the culprits. I only have tested that codes with the same results. I wrote here just to see if you find the solution.
#5
@
6 years ago
- Keywords reporter-feedback removed
I've looked into this and I think you are correct about this being broken, there is an issue with saving drafts specifically.
If post is scheduled, the preview date is correct. However when draft, with explicit scheduled date, is saved/previewed it's not.
The underlying reason seems to be that wp_update_post()
will explicitly strip a date from draft
unless edit_date
flag is set in post data. I am not sure what the legacy behavior was, but for the current Gutenberg/REST API approach that flag is not being set on draft save.
I am guessing this is not intended behavior, but I am not familiar with Gutenberg enough to say for sure / look through front–end logic.
#6
@
6 years ago
Thanks for the answer.
So, we find something to fix (may be). That's a good thing I think.
What would be the next steps to leave this concern to the support team?
I need to keep this thread open until I find out that someone was fixed the problem the future or I can mark it as resolved?
#8
@
2 years ago
I spoke to someone who was having trouble with exactly this today (all of three years later), and did some testing myself. It looks like at the moment this happens still on WP 6.1 with no plugins at all and a NON-Site Editor theme like Twenty Twenty One.
If I activate a Site Editor-compatible theme like Twenty Twenty-Two or Twenty-Twenty Three, it doesn't occur.
I did also try activating the Classic Editor plugin and the issue remains.
WP 6.1, no plugins, 'classic' theme, Post is scheduled/backdated AND draft: loading the preview shows the current date, not the date on which the post should be published.
When the post is actually published, it shows the correct date.
For reference, I opened a report with Automattic too: https://github.com/Automattic/wp-calypso/issues/70756
Could you please provide a more specific example of what date are you scheduling and where do you see the unexpected output?