From d61b1474f98a829cc544c3f30ea39de4e26003d5 Mon Sep 17 00:00:00 2001 From: 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: http://svn.automattic.com/wordpress/trunk@19305 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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 ddf817e74..c425a0414 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; }