WordPress.org

Make WordPress Core

Changeset 19305


Ignore:
Timestamp:
11/15/11 21:19:29 (2 years ago)
Author:
nacin
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r19283 r19305  
    24402440    } 
    24412441 
    2442     if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) && ('attachment' != $post_type) ) { 
     2442    $maybe_empty = ! $post_content && ! $post_title && ! $post_excerpt && post_type_supports( $post_type, 'editor' ) 
     2443        && post_type_supports( $post_type, 'title' ) && post_type_supports( $post_type, 'excerpt' ); 
     2444    if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) { 
    24432445        if ( $wp_error ) 
    2444             return new WP_Error('empty_content', __('Content, title, and excerpt are empty.')); 
     2446            return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) ); 
    24452447        else 
    24462448            return 0; 
Note: See TracChangeset for help on using the changeset viewer.