diff --git src/wp-includes/post.php src/wp-includes/post.php
index 1796dde..ee66869 100644
|
|
function wp_insert_post( $postarr, $wp_error = false ) { |
3214 | 3214 | |
3215 | 3215 | $postarr = wp_parse_args( $postarr, $defaults ); |
3216 | 3216 | |
| 3217 | // The data is innocent until proven guilty. |
| 3218 | $is_valid = true; |
| 3219 | |
| 3220 | /** |
| 3221 | * Hooks in before insert post is properly run. |
| 3222 | * |
| 3223 | * @since 4.9 |
| 3224 | * |
| 3225 | * @param bool $is_valid An indicator of whether the post data is valid. |
| 3226 | * @param array $postarr An array of raw post data. |
| 3227 | */ |
| 3228 | $is_valid = apply_filters( 'pre_insert_post', $is_valid, $postarr ); |
| 3229 | |
| 3230 | if ( ! $is_valid ) { |
| 3231 | return new WP_Error( 'invalid_data', __( "The data supplied isn't valid." ) ); |
| 3232 | } |
| 3233 | |
3217 | 3234 | unset( $postarr['filter'] ); |
3218 | 3235 | |
3219 | 3236 | $postarr = sanitize_post( $postarr, 'db' ); |