wppaste
WordPress

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

Since
2.7.0, 5.4.1, 6.0.0
Filters slashed post data just before it is inserted into 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 post data.
$postarrarray
An array of sanitized (and slashed) but otherwise unmodified post data.
$unsanitized_postarrarray
An array of slashed yet unsanitized and unprocessed post data as originally passed to wp_insert_post().
$updatebool
Whether this is an existing post being updated.

Where this hook fires · 1

  • wp-includes/post.php:4811wp_insert_post()

Source code

		 * @param array $data                An array of slashed, sanitized, and processed post data.		 * @param array $postarr             An array of sanitized (and slashed) but otherwise unmodified post data.		 * @param array $unsanitized_postarr An array of slashed yet *unsanitized* and unprocessed post data as		 *                                   originally passed to wp_insert_post().		 * @param bool  $update              Whether this is an existing post being updated.		 */		$data = apply_filters( 'wp_insert_post_data', $data, $postarr, $unsanitized_postarr, $update );	} 	$data  = wp_unslash( $data );	$where = array( 'ID' => $post_id ); 	if ( $update ) {

Changelog

Introduced in 2.7.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

6.0.0
The $update parameter was added.from the docblock
5.4.1
The $unsanitized_postarr parameter was added.from the docblock
2.7.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 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.