[wp-trac] [WordPress Trac] #62468: wp_update_post overwrites post_date when updating post_status
WordPress Trac
noreply at wordpress.org
Mon Oct 6 00:37:53 UTC 2025
#62468: wp_update_post overwrites post_date when updating post_status
---------------------------------------------+---------------------
Reporter: aguerra07 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.9
Component: Posts, Post Types | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests commit | Focuses:
---------------------------------------------+---------------------
Comment (by rollybueno):
== Test Report
=== Description
This report validates whether the indicated patch works as expected.
Patch tested: https://github.com/WordPress/wordpress-develop/pull/9699/
=== Environment
- WordPress: 6.8.3
- PHP: 8.2.27
- Server: nginx/1.26.1
- Database: mysqli (Server: 8.0.35 / Client: mysqlnd 8.2.27)
- Browser: Chrome 140.0.0.0
- OS: Linux
- Theme: Twenty Twenty-Five 1.3
- MU Plugins: None activated
- Plugins:
* Test Reports 1.2.0
=== Actual Results
1. ✅ Issue resolved with patch.
=== Additional Notes
- Tested using Local WP since my Docker having an issue.
- Only test the code update from this line https://github.com/WordPress
/wordpress-develop/pull/9699/files#diff-
ef9c5475561d459917dac57d21e08a6dfeb36f8b1c44b978d3696aec8b97c405R5215
- Wasn't able to run the test unit due to Docker issue I have right now,
so hopefully someone can give it a try on their end.
- Code used on Step 2 in the trac description:
{{{
// Trac #62468 Reproduction: wp_update_post overwrites post_date when
updating post_status
add_action( 'init', 'trac_62468_reproduction' );
function trac_62468_reproduction() {
if ( ! current_user_can( 'manage_options' ) ) {
return;
}
// Update the value here to match with your test post
$post_id = 24;
if ( is_wp_error( $post_id ) ) {
error_log( 'Error creating post: ' .
$post_id->get_error_message() );
return;
}
$future_date = date( 'Y-m-d H:i:s', strtotime( '+100 day' ) );
wp_update_post( array(
'ID' => $post_id,
'post_status' => 'future',
'post_date' => $future_date,
) );
}
}}}
=== Supplemental Artifacts
Before Patch:
- Edit post - https://i.imgur.com/IuxiFxz.png
- Post table - https://i.imgur.com/ydLq5Iu.png
- After modifying the status and future dates -
https://i.imgur.com/bkOZ7Vt.png | https://i.imgur.com/COyoxjW.png
After Patch:
- Edit Post - https://i.imgur.com/Eq4XkfA.png
- Post table - https://i.imgur.com/XdzWjpy.png
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62468#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list