wppaste
WordPress

do_action( 'pre_post_insert', array $data )

Since
6.9.0
Fires immediately before a new post is inserted in the database.

Compatibility

WordPress
since 6.9.0
  • 6.7.10
  • 6.8.11
  • 6.9.10
  • 7.0.7
  • 7.1.3

Present in 3 of the 5 tracked releases, added in 6.9.0.

Parameters

$dataarray
Array of unslashed post data.

Where this hook fires · 1

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

Source code

		 * Fires immediately before a new post is inserted in the database.		 *		 * @since 6.9.0		 *		 * @param array $data Array of unslashed post data.		 */		do_action( 'pre_post_insert', $data ); 		if ( false === $wpdb->insert( $wpdb->posts, $data ) ) {			if ( $wp_error ) {				if ( 'attachment' === $post_type ) {					$message = __( 'Could not insert attachment into the database.' );				} else {

Changelog

Introduced in 6.9.0. Unchanged from 6.9.10 through 7.1.3.

  1. 6.9.10
  2. 7.0.7
  3. 7.1.3

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

About this page

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