Make WordPress Core

Changeset 52691


Ignore:
Timestamp:
02/08/2022 12:22:29 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Posts, Post Types: Pass the $update parameter to wp_insert_post_data and wp_insert_attachment_data filters.

This makes it easier to determine in a callback function whether this is an existing post being updated or not.

Follow-up to [8635], [8702], [27130], [27138], [28106], [28788], [47633].

Props nhadsall, mukesh27.
Fixes #46228.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r52670 r52691  
    43654365         *
    43664366         * @since 3.9.0
    4367          * @since 5.4.1 `$unsanitized_postarr` argument added.
     4367         * @since 5.4.1 The `$unsanitized_postarr` parameter was added.
     4368         * @since 6.0.0 The `$update` parameter was added.
    43684369         *
    43694370         * @param array $data                An array of slashed, sanitized, and processed attachment post data.
     
    43714372         * @param array $unsanitized_postarr An array of slashed yet *unsanitized* and unprocessed attachment post data
    43724373         *                                   as originally passed to wp_insert_post().
     4374         * @param bool  $update              Whether this is an existing attachment post being updated.
    43734375         */
    4374         $data = apply_filters( 'wp_insert_attachment_data', $data, $postarr, $unsanitized_postarr );
     4376        $data = apply_filters( 'wp_insert_attachment_data', $data, $postarr, $unsanitized_postarr, $update );
    43754377    } else {
    43764378        /**
     
    43784380         *
    43794381         * @since 2.7.0
    4380          * @since 5.4.1 `$unsanitized_postarr` argument added.
     4382         * @since 5.4.1 The `$unsanitized_postarr` parameter was added.
     4383         * @since 6.0.0 The `$update` parameter was added.
    43814384         *
    43824385         * @param array $data                An array of slashed, sanitized, and processed post data.
     
    43844387         * @param array $unsanitized_postarr An array of slashed yet *unsanitized* and unprocessed post data as
    43854388         *                                   originally passed to wp_insert_post().
     4389         * @param bool  $update              Whether this is an existing post being updated.
    43864390         */
    4387         $data = apply_filters( 'wp_insert_post_data', $data, $postarr, $unsanitized_postarr );
     4391        $data = apply_filters( 'wp_insert_post_data', $data, $postarr, $unsanitized_postarr, $update );
    43884392    }
    43894393
Note: See TracChangeset for help on using the changeset viewer.