Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r12163 r12307  
    11871187    delete_post_meta($postid,'_wp_trash_meta_time');
    11881188
    1189     /** @todo delete for pluggable post taxonomies too */
    1190     wp_delete_object_term_relationships($postid, array('category', 'post_tag'));
     1189    wp_delete_object_term_relationships($postid, get_object_taxonomies($post->post_type));
    11911190
    11921191    $parent_data = array( 'post_parent' => $post->post_parent );
     
    12381237    }
    12391238
    1240     do_action( 'delete_post', $post_id );
     1239    do_action( 'delete_post', $postid );
    12411240    $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid ));
    1242     do_action( 'deleted_post', $post_id );
     1241    do_action( 'deleted_post', $postid );
    12431242
    12441243    if ( 'page' == $post->post_type ) {
     
    15051504    // Set the limit clause, if we got a limit
    15061505    $num = (int) $num;
    1507     if ($num) {
     1506    if ( $num ) {
    15081507        $limit = "LIMIT $num";
    15091508    }
    15101509
    1511     $sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC $limit";
    1512     $result = $wpdb->get_results($sql,ARRAY_A);
     1510    $sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' AND post_status IN ( 'draft', 'publish', 'future', 'pending', 'private' ) ORDER BY post_date DESC $limit";
     1511    $result = $wpdb->get_results($sql, ARRAY_A);
    15131512
    15141513    return $result ? $result : array();
     
    16111610    }
    16121611
    1613     if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) ) {
     1612    if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) && ('attachment' != $post_type) ) {
    16141613        if ( $wp_error )
    16151614            return new WP_Error('empty_content', __('Content, title, and excerpt are empty.'));
     
    19421941 * Given the desired slug and some post details computes a unique slug for the post.
    19431942 *
     1943 * @global wpdb $wpdb
     1944 * @global WP_Rewrite $wp_rewrite
    19441945 * @param string $slug the desired slug (post_name)
    19451946 * @param integer $post_ID
     
    19541955
    19551956    global $wpdb, $wp_rewrite;
     1957
     1958    $feeds = $wp_rewrite->feeds;
     1959    if ( !is_array($feeds) )
     1960        $feeds = array();
     1961
    19561962    $hierarchical_post_types = apply_filters('hierarchical_post_types', array('page'));
    19571963    if ( 'attachment' == $post_type ) {
     
    19601966        $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID));
    19611967
    1962         if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
     1968        if ( $post_name_check || in_array($slug, $feeds) ) {
    19631969            $suffix = 2;
    19641970            do {
     
    19751981        $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID, $post_parent));
    19761982
    1977         if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) {
     1983        if ( $post_name_check || in_array($slug, $feeds) ) {
    19781984            $suffix = 2;
    19791985            do {
     
    26002606            $excludes[] = $child->ID;
    26012607        $excludes[] = $exclude;
     2608        $num_pages = count($pages);
    26022609        for ( $i = 0; $i < $num_pages; $i++ ) {
    26032610            if ( in_array($pages[$i]->ID, $excludes) )
     
    27972804    clean_post_cache($post_ID);
    27982805
     2806    if ( isset($post_parent) && $post_parent < 0 )
     2807        add_post_meta($post_ID, '_wp_attachment_temp_parent', $post_parent, true);
     2808
    27992809    if ( $update) {
    28002810        do_action('edit_attachment', $post_ID);
     
    28422852    do_action('delete_attachment', $post_id);
    28432853
    2844     /** @todo Delete for pluggable post taxonomies too */
    28452854    wp_delete_object_term_relationships($post_id, array('category', 'post_tag'));
     2855    wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type));
    28462856
    28472857    $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id' AND meta_value = %d", $post_id ));
     
    36963706function wp_save_post_revision( $post_id ) {
    36973707    // We do autosaves manually with wp_create_post_autosave()
    3698     if ( @constant( 'DOING_AUTOSAVE' ) )
     3708    if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
    36993709        return;
    37003710
Note: See TracChangeset for help on using the changeset viewer.