WordPress.org

Make WordPress Core

Ticket #1073: bug1073_blankslug_post.diff

File bug1073_blankslug_post.diff, 1.3 KB (added by coffee2code, 16 years ago)
  • wp-admin/post.php

     
    104104        $id_result = $wpdb->get_row("SHOW TABLE STATUS LIKE '$wpdb->posts'");
    105105        $post_ID = $id_result->Auto_increment;
    106106
    107         if ( empty($post_name) || 'draft' == $post_status ) {
    108                 $post_name = sanitize_title($post_title, $post_ID);
     107        if ( empty($post_name) ) {
     108                if ( 'draft' != $post_status )
     109                        $post_name = sanitize_title($post_title, $post_ID);
    109110        } else {
    110111                $post_name = sanitize_title($post_name, $post_ID);
    111112        }
     
    290291        //if (!$_POST['ping_status']) $ping_status = get_settings('default_ping_status');
    291292        $post_password = $_POST['post_password'];
    292293        $post_name = $_POST['post_name'];
    293         if (empty($post_name)) {
    294                 $post_name = $post_title;
    295         }
    296294
    297295        $post_parent = 0;
    298296        if (isset($_POST['parent_id'])) {
     
    308306        if ( 'publish' == $post_status && (!user_can_create_post($user_ID)) && 2 != get_option('new_users_can_blog') )
    309307                $post_status = 'draft';
    310308
    311         if (empty($post_name) || 'draft' == $post_status ) {
    312                 $post_name = sanitize_title($post_title, $post_ID);
     309        if ( empty($post_name) ) {
     310                if ( 'draft' != $post_status )
     311                        $post_name = sanitize_title($post_title, $post_ID);
    313312        } else {
    314313                $post_name = sanitize_title($post_name, $post_ID);
    315314        }