Make WordPress Core


Ignore:
Timestamp:
10/16/2020 03:32:11 AM (4 years ago)
Author:
peterwilsoncc
Message:

REST API, Posts: Add a hook to fire once a post, its terms and meta update.

Introduces the action wp_after_insert_post inside a wrapper function of the same name. This hook allows plugin developers to access a posts full data (including its terms and meta data) regardless of the workflow used to save it.

A new parameter is introduced to wp_insert_post() to indicate whether the hook should be fired within the function call or will be fired afterward.

Props aristath, Collizo4sky, danielbachhuber, joyously, kadamwhite, kraftbj, markparnell, mikeschroder, noisysocks, peterwilsoncc, SergeyBiryukov, talldanwp, thewebprincess, TimothyBlynJacobs.
Fixes #45114.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-manager.php

    r49108 r49172  
    31053105        /** This action is documented in wp-includes/post.php */
    31063106        do_action( 'wp_insert_post', $post->ID, $post, true );
     3107
     3108        wp_after_insert_post( $post, true );
    31073109
    31083110        wp_trash_post_comments( $post_id );
Note: See TracChangeset for help on using the changeset viewer.