Posts: Display Scheduled
state for future-dated private posts
#9389
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trac ticket: https://core.trac.wordpress.org/ticket/18264
This PR fixes a UI inconsistency where private posts scheduled for a future date do not display the "Scheduled" state in the
All Posts
list table. Public and password-protected posts correctly show this state, and this change brings the behavior for private posts into alignment.The fix adds a condition to the
get_post_states()
function. It checks if a post with a 'private' status has apost_date_gmt
set in the future and, if so, appends the "Scheduled" state to be displayed.How to test:
This change also introduces new unit tests to ensure correctness and prevent future regressions. The tests confirm that a future-dated private post correctly receives both "Private" and "Scheduled" states.
Run the tests -