Changes in trunk/wp-includes/post.php [12163:12307]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r12163 r12307 1187 1187 delete_post_meta($postid,'_wp_trash_meta_time'); 1188 1188 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)); 1191 1190 1192 1191 $parent_data = array( 'post_parent' => $post->post_parent ); … … 1238 1237 } 1239 1238 1240 do_action( 'delete_post', $post _id );1239 do_action( 'delete_post', $postid ); 1241 1240 $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 ); 1243 1242 1244 1243 if ( 'page' == $post->post_type ) { … … 1505 1504 // Set the limit clause, if we got a limit 1506 1505 $num = (int) $num; 1507 if ( $num) {1506 if ( $num ) { 1508 1507 $limit = "LIMIT $num"; 1509 1508 } 1510 1509 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); 1513 1512 1514 1513 return $result ? $result : array(); … … 1611 1610 } 1612 1611 1613 if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) ) {1612 if ( ('' == $post_content) && ('' == $post_title) && ('' == $post_excerpt) && ('attachment' != $post_type) ) { 1614 1613 if ( $wp_error ) 1615 1614 return new WP_Error('empty_content', __('Content, title, and excerpt are empty.')); … … 1942 1941 * Given the desired slug and some post details computes a unique slug for the post. 1943 1942 * 1943 * @global wpdb $wpdb 1944 * @global WP_Rewrite $wp_rewrite 1944 1945 * @param string $slug the desired slug (post_name) 1945 1946 * @param integer $post_ID … … 1954 1955 1955 1956 global $wpdb, $wp_rewrite; 1957 1958 $feeds = $wp_rewrite->feeds; 1959 if ( !is_array($feeds) ) 1960 $feeds = array(); 1961 1956 1962 $hierarchical_post_types = apply_filters('hierarchical_post_types', array('page')); 1957 1963 if ( 'attachment' == $post_type ) { … … 1960 1966 $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID)); 1961 1967 1962 if ( $post_name_check || in_array($slug, $ wp_rewrite->feeds) ) {1968 if ( $post_name_check || in_array($slug, $feeds) ) { 1963 1969 $suffix = 2; 1964 1970 do { … … 1975 1981 $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID, $post_parent)); 1976 1982 1977 if ( $post_name_check || in_array($slug, $ wp_rewrite->feeds) ) {1983 if ( $post_name_check || in_array($slug, $feeds) ) { 1978 1984 $suffix = 2; 1979 1985 do { … … 2600 2606 $excludes[] = $child->ID; 2601 2607 $excludes[] = $exclude; 2608 $num_pages = count($pages); 2602 2609 for ( $i = 0; $i < $num_pages; $i++ ) { 2603 2610 if ( in_array($pages[$i]->ID, $excludes) ) … … 2797 2804 clean_post_cache($post_ID); 2798 2805 2806 if ( isset($post_parent) && $post_parent < 0 ) 2807 add_post_meta($post_ID, '_wp_attachment_temp_parent', $post_parent, true); 2808 2799 2809 if ( $update) { 2800 2810 do_action('edit_attachment', $post_ID); … … 2842 2852 do_action('delete_attachment', $post_id); 2843 2853 2844 /** @todo Delete for pluggable post taxonomies too */2845 2854 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)); 2846 2856 2847 2857 $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id' AND meta_value = %d", $post_id )); … … 3696 3706 function wp_save_post_revision( $post_id ) { 3697 3707 // We do autosaves manually with wp_create_post_autosave() 3698 if ( @constant( 'DOING_AUTOSAVE' ))3708 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 3699 3709 return; 3700 3710
Note: See TracChangeset
for help on using the changeset viewer.