Make WordPress Core

Changeset 43535 for trunk


Ignore:
Timestamp:
07/25/2018 08:56:39 PM (8 years ago)
Author:
SergeyBiryukov
Message:

Posts, Post Types: Introduce edit_post_{$post->post_type} hook.

The hook fires before the general edit_post hook and has the same parameters.

It also complements the save_post_{$post->post_type} hook added in [25050].

Props Mte90, garrett-eclipse.
Fixes #34706.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

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

    r43174 r43535  
    29882988                $post->post_status = $new_status;
    29892989                wp_transition_post_status( $new_status, $old_status, $post );
     2990
     2991                /** This action is documented in wp-includes/post.php */
     2992                do_action( "edit_post_{$post->post_type}", $post->ID, $post );
    29902993
    29912994                /** This action is documented in wp-includes/post.php */
  • trunk/src/wp-includes/comment.php

    r43467 r43535  
    24722472         */
    24732473        do_action( 'wp_update_comment_count', $post_id, $new, $old );
     2474
     2475        /** This action is documented in wp-includes/post.php */
     2476        do_action( "edit_post_{$post->post_type}", $post_id, $post );
     2477
    24742478        /** This action is documented in wp-includes/post.php */
    24752479        do_action( 'edit_post', $post_id, $post );
  • trunk/src/wp-includes/post.php

    r43520 r43535  
    38003800                 * Fires once an existing post has been updated.
    38013801                 *
     3802                 * The dynamic portion of the hook name, `$post->post_type`, refers to
     3803                 * the post type slug.
     3804                 *
     3805                 * @since 5.0.0
     3806                 *
     3807                 * @param int     $post_ID Post ID.
     3808                 * @param WP_Post $post    Post object.
     3809                 */
     3810                do_action( "edit_post_{$post->post_type}", $post_ID, $post );
     3811
     3812                /**
     3813                 * Fires once an existing post has been updated.
     3814                 *
    38023815                 * @since 1.2.0
    38033816                 *
    … …  
    38063819                 */
    38073820                do_action( 'edit_post', $post_ID, $post );
     3821
    38083822                $post_after = get_post( $post_ID );
    38093823
    … …  
    39503964        $post->post_status = 'publish';
    39513965        wp_transition_post_status( 'publish', $old_status, $post );
     3966
     3967        /** This action is documented in wp-includes/post.php */
     3968        do_action( "edit_post_{$post->post_type}", $post->ID, $post );
    39523969
    39533970        /** This action is documented in wp-includes/post.php */
Note: See TracChangeset for help on using the changeset viewer.