Changeset 49732
- Timestamp:
- 12/01/2020 08:55:03 PM (4 years ago)
- Location:
- branches/5.6
- Files:
-
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/5.6
-
branches/5.6/src/wp-admin/includes/post.php
r49614 r49732 688 688 ), 689 689 false, 690 true690 false 691 691 ); 692 692 $post = get_post( $post_id ); … … 694 694 set_post_format( $post, get_option( 'default_post_format' ) ); 695 695 } 696 wp_after_insert_post( $post, false );696 wp_after_insert_post( $post, false, null ); 697 697 698 698 // Schedule auto-draft cleanup. -
branches/5.6/src/wp-includes/class-wp-customize-manager.php
r49193 r49732 3106 3106 do_action( 'wp_insert_post', $post->ID, $post, true ); 3107 3107 3108 wp_after_insert_post( $post, true);3108 wp_after_insert_post( get_post( $post_id ), true, $post ); 3109 3109 3110 3110 wp_trash_post_comments( $post_id ); -
branches/5.6/src/wp-includes/post.php
r49684 r49732 3718 3718 } else { 3719 3719 $previous_status = 'new'; 3720 $post_before = null; 3720 3721 } 3721 3722 … … 4320 4321 4321 4322 if ( $fire_after_hooks ) { 4322 wp_after_insert_post( $post, $update );4323 wp_after_insert_post( $post, $update, $post_before ); 4323 4324 } 4324 4325 … … 4433 4434 } 4434 4435 4436 $post_before = get_post( $post->ID ); 4437 4435 4438 // Ensure at least one term is applied for taxonomies with a default term. 4436 4439 foreach ( get_object_taxonomies( $post->post_type, 'object' ) as $taxonomy => $tax_object ) { … … 4483 4486 do_action( 'wp_insert_post', $post->ID, $post, true ); 4484 4487 4485 wp_after_insert_post( $post, true );4488 wp_after_insert_post( $post, true, $post_before ); 4486 4489 } 4487 4490 … … 4938 4941 * @since 5.6.0 4939 4942 * 4940 * @param int|WP_Post $post The post ID or object that has been saved. 4941 * @param bool $update Whether this is an existing post being updated. 4942 */ 4943 function wp_after_insert_post( $post, $update ) { 4943 * @param int|WP_Post $post The post ID or object that has been saved. 4944 * @param bool $update Whether this is an existing post being updated. 4945 * @param null|WP_Post $post_before Null for new posts, the WP_Post object prior 4946 * to the update for updated posts. 4947 */ 4948 function wp_after_insert_post( $post, $update, $post_before ) { 4944 4949 $post = get_post( $post ); 4945 4950 if ( ! $post ) { … … 4954 4959 * @since 5.6.0 4955 4960 * 4956 * @param int $post_id Post ID. 4957 * @param WP_Post $post Post object. 4958 * @param bool $update Whether this is an existing post being updated. 4961 * @param int $post_id Post ID. 4962 * @param WP_Post $post Post object. 4963 * @param bool $update Whether this is an existing post being updated. 4964 * @param null|WP_Post $post_before Null for new posts, the WP_Post object prior 4965 * to the update for updated posts. 4959 4966 */ 4960 do_action( 'wp_after_insert_post', $post_id, $post, $update );4967 do_action( 'wp_after_insert_post', $post_id, $post, $update, $post_before ); 4961 4968 } 4962 4969 -
branches/5.6/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
r49172 r49732 192 192 do_action( 'rest_after_insert_attachment', $attachment, $request, true ); 193 193 194 wp_after_insert_post( $attachment, false );194 wp_after_insert_post( $attachment, false, null ); 195 195 196 196 if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) { … … 322 322 } 323 323 324 $response = parent::update_item( $request ); 324 $attachment_before = get_post( $request['id'] ); 325 $response = parent::update_item( $request ); 325 326 326 327 if ( is_wp_error( $response ) ) { … … 348 349 do_action( 'rest_after_insert_attachment', $attachment, $request, false ); 349 350 350 wp_after_insert_post( $attachment, true );351 wp_after_insert_post( $attachment, true, $attachment_before ); 351 352 352 353 $response = $this->prepare_item_for_response( $attachment, $request ); -
branches/5.6/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
r49302 r49732 678 678 do_action( "rest_after_insert_{$this->post_type}", $post, $request, true ); 679 679 680 wp_after_insert_post( $post, false );680 wp_after_insert_post( $post, false, null ); 681 681 682 682 $response = $this->prepare_item_for_response( $post, $request ); … … 754 754 } 755 755 756 $post = $this->prepare_item_for_database( $request ); 756 $post_before = get_post( $request['id'] ); 757 $post = $this->prepare_item_for_database( $request ); 757 758 758 759 if ( is_wp_error( $post ) ) { … … 831 832 do_action( "rest_after_insert_{$this->post_type}", $post, $request, false ); 832 833 833 wp_after_insert_post( $post, true );834 wp_after_insert_post( $post, true, $post_before ); 834 835 835 836 $response = $this->prepare_item_for_response( $post, $request );
Note: See TracChangeset
for help on using the changeset viewer.