Make WordPress Core


Ignore:
Timestamp:
12/01/2020 08:45:43 PM (4 years ago)
Author:
johnbillion
Message:

REST API: Pass the previous state of the post as a parameter to the wp_after_insert_post hook.

This enables, for example, the previous post status to be used by this hook without the need to first capture it on an earlier hook.

This also fixes the value of the $fire_after_hooks parameter in get_default_post_to_edit() so the wp_after_insert_post action correctly fires just once on the new post screen.

Props Collizo4sky, peterwilsoncc, hellofromTonya, TimothyBlynJacobs, SergeyBiryukov

Fixes #45114

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/post.php

    r49614 r49731  
    688688            ),
    689689            false,
    690             true
     690            false
    691691        );
    692692        $post    = get_post( $post_id );
     
    694694            set_post_format( $post, get_option( 'default_post_format' ) );
    695695        }
    696         wp_after_insert_post( $post, false );
     696        wp_after_insert_post( $post, false, null );
    697697
    698698        // Schedule auto-draft cleanup.
Note: See TracChangeset for help on using the changeset viewer.