From 88b1b11435e6d3d9c89a58be2119034b9914c37b Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Tue, 15 Nov 2011 21:19:29 +0000 Subject: [PATCH] Only enforce content/title/excerpt requirement in wp_insert_post() if the post type supports all three. Add a filter to allow this to be modified. fixes #18713. git-svn-id: https://develop.svn.wordpress.org/trunk@19305 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index ddf817e742..c425a04149 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2439,9 +2439,11 @@ function wp_insert_post($postarr, $wp_error = false) { $previous_status = 'new'; } - if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) && ('attachment' != $post_type) ) { + $maybe_empty = ! $post_content && ! $post_title && ! $post_excerpt && post_type_supports( $post_type, 'editor' ) + && post_type_supports( $post_type, 'title' ) && post_type_supports( $post_type, 'excerpt' ); + if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) { if ( $wp_error ) - return new WP_Error('empty_content', __('Content, title, and excerpt are empty.')); + return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) ); else return 0; }