Make WordPress Core


Ignore:
Timestamp:
11/23/2016 03:32:25 PM (9 years ago)
Author:
rachelbaker
Message:

REST API: Always fire the rest_insert_* actions after the related object is updated or inserted.

Brings consistency to the rest_insert_* actions. Also includes some shuffling and clean-up as well including:

  • Ensure we are passing the most current $post and $user objects to the update_additional_fields_for_object() callbacks.
  • Changes the function signature of handle_status_param() in the Comments controller to accept just the comment_id as the 2nd parameter, instead of a full WP_Comment object. Only the comment_id is needed in the method, this avoids having to include another get_comment() call.
  • Renames a variable in the create_item() method of the Posts controller from $post -> $prepared_post to be more explicit.
  • Minor fixes/clarifications to the rest_insert_* hook docs

Props rachelbaker, joehoyle
Fixes #38905.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php

    r39342 r39348  
    404404         * @since 4.7.0
    405405         *
    406          * @param WP_Term         $term     Inserted Term object.
     406         * @param WP_Term         $term     Inserted or updated term object.
    407407         * @param WP_REST_Request $request  Request object.
    408          * @param bool            $creating True when creating term, false when updating.
     408         * @param bool            $creating True when creating a term, false when updating.
    409409         */
    410410        do_action( "rest_insert_{$this->taxonomy}", $term, $request, true );
Note: See TracChangeset for help on using the changeset viewer.