[wp-trac] [WordPress Trac] #45801: Duplicate post publish action

WordPress Trac noreply at wordpress.org
Wed Sep 3 13:06:37 UTC 2025


#45801: Duplicate post publish action
-------------------------------+-------------------------
 Reporter:  bmettee4           |       Owner:  (none)
     Type:  defect (bug)       |      Status:  closed
 Priority:  normal             |   Milestone:
Component:  Posts, Post Types  |     Version:  5.0.2
 Severity:  normal             |  Resolution:  worksforme
 Keywords:                     |     Focuses:
-------------------------------+-------------------------
Changes (by SirLouen):

 * status:  new => closed
 * resolution:   => worksforme
 * milestone:  Awaiting Review =>


Comment:

 == Reproduction Report
 === Description
 ❌ This can't validates 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 139.0.0.0
 - OS: Windows 10/11
 - Theme: Twenty Twenty-Five 1.3
 - MU Plugins: None activated
 - Plugins:
   * BBB Testing Dolly
   * Test Reports 1.2.0

 === Reproduciton instructions

 1. Add the code to a plugin, in the supp artifacts. This code simply add
 post meta, everytime a post is updated
 2. Create a new post
 3. Update the post
 4. 👌 Only one call is done to `publish_to_publish`

 === Actual Results
 1. ❌ Error condition is not occurring.

 === Additional Notes
 - I'm going to close this for two reasons:

 1. The first reason is that its not reproducible
 2. The second, is that even if there are double calls to hooks, they can
 be easily controlled either with a transient, temporary meta, or with a
 static variable if it's a callback, just to name some. There are many ways
 to handle this.

 === Supplemental Artifacts

 {{{
 add_action( 'post_updated', 'bb_testing_add_update_meta', 10, 1 );
 function bb_testing_add_update_meta( $post_ID ) {
         if ( wp_is_post_autosave( $post_ID ) || wp_is_post_revision(
 $post_ID ) ) {
                 return;
         }
         $timestamp = current_time( 'mysql' );
         add_post_meta( $post_ID, '_bb_testing_last_' . $timestamp,
 $timestamp );
 }
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45801#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list