wp_insert_attachment_data WordPress Filter Hook

The wp_insert_attachment_data hook is used to filter data before it is updated in the database. This is useful for sanitizing data before saving it to the database, or for adding extra data to be saved.

apply_filters( 'wp_insert_attachment_data', array $data, array $postarr, array $unsanitized_postarr, bool $update ) #

Filters attachment post data before it is updated in or added to the database.


Parameters

$data

(array)An array of slashed, sanitized, and processed attachment post data.

$postarr

(array)An array of slashed and sanitized attachment post data, but not processed.

$unsanitized_postarr

(array)An array of slashed yet *unsanitized* and unprocessed attachment post data as originally passed to wp_insert_post().

$update

(bool)Whether this is an existing attachment post being updated.


Top ↑

Source

File: wp-includes/post.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
6.0.0The $update parameter was added.
5.4.1The $unsanitized_postarr parameter was added.
3.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More