WordPress.org

Make WordPress Core

Changeset 1813


Ignore:
Timestamp:
10/18/2004 03:58:06 PM (16 years ago)
Author:
michelvaldrighi
Message:

fix for bug #328: better/sane way to get before using it as a fallback for post_name

File:
1 edited

Legend:

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

    r1812 r1813  
    4444        die('You are not allowed to create posts or drafts on this blog.');
    4545    }
    46 
    47     $post_ID = $wpdb->get_var("SELECT MAX(ID) FROM $wpdb->posts") + 1;
    4846
    4947    $post_pingback = intval($_POST['post_pingback']);
     
    7472    $post_password = $_POST['post_password'];
    7573   
    76     if ( empty($post_name) ) {
    77         if ( !empty($post_title) )
    78             $post_name = sanitize_title($post_title, $post_ID);
    79     } else {
    80         $post_name = sanitize_title($post_name, $post_ID);
    81     }
    82 
    8374    $trackback = $_POST['trackback_url'];
    8475    $trackback = preg_replace('|\s+|', "\n", $trackback);
     
    10899    if ('' != $_POST['advanced']) $post_status = 'draft';
    109100    if ('' != $_POST['savepage']) $post_status = 'static';
     101
     102    $id_result = $wpdb->get_row("SHOW TABLE STATUS LIKE '$wpdb->posts'");
     103    $post_ID = $id_result->Auto_increment;
     104
     105    if ( empty($post_name) ) {
     106        if ( !empty($post_title) )
     107            $post_name = sanitize_title($post_title, $post_ID);
     108    } else {
     109        $post_name = sanitize_title($post_name, $post_ID);
     110    }
    110111
    111112    $postquery ="INSERT INTO $wpdb->posts
Note: See TracChangeset for help on using the changeset viewer.