apply_filters( 'wp_insert_attachment_data', array $data, array $postarr, array $unsanitized_postarr, bool $update )
- Since
- 3.9.0, 5.4.1, 6.0.0
Filters attachment post data before it is updated in or added to the database.
Compatibility
- WordPress
- since 6.0.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$dataarray- An array of slashed, sanitized, and processed attachment post data.
$postarrarray- An array of slashed and sanitized attachment post data, but not processed.
$unsanitized_postarrarray- An array of slashed yet unsanitized and unprocessed attachment post data as originally passed to wp_insert_post().
$updatebool- Whether this is an existing attachment post being updated.
Where this hook fires · 1
wp-includes/post.php:4746wp_insert_post()
Source code
* @param array $data An array of slashed, sanitized, and processed attachment post data. * @param array $postarr An array of slashed and sanitized attachment post data, but not processed. * @param array $unsanitized_postarr An array of slashed yet *unsanitized* and unprocessed attachment post data * as originally passed to wp_insert_post(). * @param bool $update Whether this is an existing attachment post being updated. */ $data = apply_filters( 'wp_insert_attachment_data', $data, $postarr, $unsanitized_postarr, $update ); } else { /** * Filters slashed post data just before it is inserted into the database. * * @since 2.7.0 * @since 5.4.1 The `$unsanitized_postarr` parameter was added.Changelog
Introduced in 3.9.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.0.0
The
$update parameter was added.from the docblock5.4.1
The
$unsanitized_postarr parameter was added.from the docblock3.9.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.