Make WordPress Core


Ignore:
Timestamp:
09/14/2005 12:34:04 AM (20 years ago)
Author:
ryan
Message:

Add clean_post_cache() and clean_page_cache(). Reset GUID when transitioning from draft to publish. fixes #1257

File:
1 edited

Legend:

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

    r2865 r2873  
    135135   
    136136    $result = $wpdb->query($postquery);
    137     if ( $update )
    138         $rval = $wpdb->rows_affected;
    139     else
    140         $rval = $wpdb->insert_id;
     137
     138    wp_set_post_cats('', $post_ID, $post_category);
     139
     140    if ( 'static' == $post_status )
     141        clean_page_cache($post_ID);
     142    else
     143        clean_post_cache($post_ID);
    141144
    142145    // Set GUID
    143146    if ( ! $update )
    144147        $wpdb->query("UPDATE $wpdb->posts SET guid = '" . get_permalink($post_ID) . "' WHERE ID = '$post_ID'");
    145    
    146     wp_set_post_cats('', $post_ID, $post_category);
    147148
    148149    if ( $update) {
    149         if ($previous_status != 'publish' && $post_status == 'publish')
     150        if ($previous_status != 'publish' && $post_status == 'publish') {
     151            // Reset GUID if transitioning to publish.
     152            $wpdb->query("UPDATE $wpdb->posts SET guid = '" . get_permalink($post_ID) . "' WHERE ID = '$post_ID'");
    150153            do_action('private_to_published', $post_ID);
     154        }
    151155       
    152156        do_action('edit_post', $post_ID);
Note: See TracChangeset for help on using the changeset viewer.