Make WordPress Core

Changeset 62927


Ignore:
Timestamp:
07/29/2026 07:05:27 PM (4 months ago)
Author:
westonruter
Message:

REST API: Pass the missing $is_update param to the wp_creating_autosave action.

The action has documented an $is_update parameter since 6.4.0, when r56714 added it. However, this new parameter was not passed to all instances of the action being fired, resulting in a possible fatal error if a callback is expecting it.

WP_REST_Autosaves_Controller::create_post_autosave() fires the action on the branch that overwrites an author's existing autosave, mirroring wp_create_post_autosave(), so true is passed.

This call site was surfaced by the PHPStan extensions under development for this ticket, which are committed separately.

Developed as subset of ​https://github.com/WordPress/wordpress-develop/pull/12022.
Follow-up to r44126, r56714.

See #65376.

File:
1 edited

Legend:

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

    r62334 r62927  
    426426
    427427                        /** This action is documented in wp-admin/includes/post.php */
    428                         do_action( 'wp_creating_autosave', $new_autosave );
     428                        do_action( 'wp_creating_autosave', $new_autosave, true );
    429429
    430430                        // wp_update_post() expects escaped array.
Note: See TracChangeset for help on using the changeset viewer.