Make WordPress Core


Ignore:
Timestamp:
02/06/2010 10:07:57 AM (15 years ago)
Author:
markjaquith
Message:

Create post_status=auto-draft when creating a new post item. status changes to draft on first auto-save. now we always have a real post ID to work with. see #11889. fixes #11145. fixes #11990

File:
1 edited

Legend:

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

    r12948 r12987  
    19771977    // post name.
    19781978    if ( !isset($post_name) || empty($post_name) ) {
    1979         if ( !in_array( $post_status, array( 'draft', 'pending' ) ) )
     1979        if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
    19801980            $post_name = sanitize_title($post_title);
    19811981        else
     
    19901990
    19911991    if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt ) {
    1992         if ( !in_array( $post_status, array( 'draft', 'pending' ) ) )
     1992        if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
    19931993            $post_date_gmt = get_gmt_from_date($post_date);
    19941994        else
     
    20902090    }
    20912091
    2092     if ( empty($data['post_name']) && !in_array( $data['post_status'], array( 'draft', 'pending' ) ) ) {
     2092    if ( empty($data['post_name']) && !in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) {
    20932093        $data['post_name'] = sanitize_title($data['post_title'], $post_ID);
    20942094        $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where );
     
    21732173
    21742174    // Drafts shouldn't be assigned a date unless explicitly done so by the user
    2175     if ( in_array($post['post_status'], array('draft', 'pending')) && empty($postarr['edit_date']) &&
     2175    if ( in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
    21762176             ('0000-00-00 00:00:00' == $post['post_date_gmt']) )
    21772177        $clear_date = true;
     
    22772277 */
    22782278function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent) {
    2279     if ( in_array( $post_status, array( 'draft', 'pending' ) ) )
     2279    if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) )
    22802280        return $slug;
    22812281
Note: See TracChangeset for help on using the changeset viewer.