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
This commit is contained in:
parent
80ee709653
commit
88b1b11435
|
@ -2439,9 +2439,11 @@ 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
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue