[wp-trac] [WordPress Trac] #53418: Post Status Transition missing Hook
WordPress Trac
noreply at wordpress.org
Thu Sep 11 23:52:55 UTC 2025
#53418: Post Status Transition missing Hook
-------------------------------------------------+-------------------------
Reporter: brettrans | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Posts, Post Types | Version: 5.7.2
Severity: blocker | Resolution: worksforme
Keywords: needs-patch needs-testing has-dev- | Focuses:
note dev-feedback |
-------------------------------------------------+-------------------------
Changes (by SirLouen):
* status: new => closed
* resolution: => worksforme
* milestone: Awaiting Review =>
Comment:
== Reproduction Report
=== Description
❌ This report can't validate that the issue can 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 2.9
- MU Plugins: None activated
- Plugins:
* BBB Testing Dolly
* Test Reports 1.2.0
=== Testing Instructions
1. Using the code I provide in the supp artifacts
2. I have create a very simple title/content form to create controlled
posts. This is very important because the editors mess up with draft
statuses and for this, we need a direct way to interact with
`wp_insert_post` passing `post_status` (both draft and pending).
3. 👌 Transitions are done as expected
=== Actual Results
1. ❌ Error condition is not occurring
=== Additional Notes
- I've been logging actions and transitions are being done timely and
without concurrence. For this reason, I have to close this as
`worksforme`. Feel free to check my code and my instructions, and reopen
if more information for testing can be provided.
=== Supplemental Artifacts
Code:
{{{
add_action( 'transition_post_status', 'log_transitions', 10, 3 );
function log_transitions( $new_status, $old_status, $post ) {
if ( ! ( ( 'new' === $old_status && 'draft' === $new_status ) ||
( 'draft' === $old_status && 'pending' === $new_status ) ||
( 'new' === $old_status && 'pending' === $new_status ) ) ) {
return;
}
$message = sprintf(
'[%s] Post ID %d: %s -> %s',
current_time( 'mysql' ),
(int) $post->ID,
$old_status,
$new_status,
);
error_log( $message );
}
}}}
Logs:
> [11-Sep-2025 23:43:29 UTC] [2025-09-11 23:43:29] Post ID 176 "fdasfa":
new -> draft by admin
> [11-Sep-2025 23:43:49 UTC] [2025-09-11 23:43:49] Post ID 177 "fdsafa":
new -> pending by admin
> [11-Sep-2025 23:44:04 UTC] [2025-09-11 23:44:04] Post ID 176 "fdasfa":
draft -> pending by admin
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53418#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list