WordPress.org

Make WordPress Core

Changeset 43617


Ignore:
Timestamp:
09/03/2018 09:11:38 PM (16 months 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.
Merges [43535] and [43616] to the 4.9 branch.
Fixes #34706.

Location:
branches/4.9
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-includes/class-wp-customize-manager.php

    r42811 r43617  
    29642964        $post->post_status = $new_status;
    29652965        wp_transition_post_status( $new_status, $old_status, $post );
     2966
     2967        /** This action is documented in wp-includes/post.php */
     2968        do_action( "edit_post_{$post->post_type}", $post->ID, $post );
    29662969
    29672970        /** This action is documented in wp-includes/post.php */
  • branches/4.9/src/wp-includes/comment.php

    r43468 r43617  
    24042404     */
    24052405    do_action( 'wp_update_comment_count', $post_id, $new, $old );
     2406
     2407    /** This action is documented in wp-includes/post.php */
     2408    do_action( "edit_post_{$post->post_type}", $post_id, $post );
     2409
    24062410    /** This action is documented in wp-includes/post.php */
    24072411    do_action( 'edit_post', $post_id, $post );
  • branches/4.9/src/wp-includes/post.php

    r43510 r43617  
    36283628         * Fires once an existing post has been updated.
    36293629         *
     3630         * The dynamic portion of the hook name, `$post->post_type`, refers to
     3631         * the post type slug.
     3632         *
     3633         * @since 4.9.9
     3634         *
     3635         * @param int     $post_ID Post ID.
     3636         * @param WP_Post $post    Post object.
     3637         */
     3638        do_action( "edit_post_{$post->post_type}", $post_ID, $post );
     3639
     3640        /**
     3641         * Fires once an existing post has been updated.
     3642         *
    36303643         * @since 1.2.0
    36313644         *
     
    36343647         */
    36353648        do_action( 'edit_post', $post_ID, $post );
    3636         $post_after = get_post($post_ID);
     3649
     3650        $post_after = get_post( $post_ID );
    36373651
    36383652        /**
     
    37723786    $post->post_status = 'publish';
    37733787    wp_transition_post_status( 'publish', $old_status, $post );
     3788
     3789    /** This action is documented in wp-includes/post.php */
     3790    do_action( "edit_post_{$post->post_type}", $post->ID, $post );
    37743791
    37753792    /** This action is documented in wp-includes/post.php */
Note: See TracChangeset for help on using the changeset viewer.