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
This commit is contained in:
parent
45ddf08e07
commit
d61b1474f9
|
@ -2439,7 +2439,9 @@ function wp_insert_post($postarr, $wp_error = false) {
|
||||||
$previous_status = 'new';
|
$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 )
|
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
|
else
|
||||||
|
|
Loading…
Reference in New Issue