WordPress.org

Make WordPress Core

Changeset 28791


Ignore:
Timestamp:
06/20/2014 07:13:39 PM (7 years ago)
Author:
wonderboymusic
Message:

Posts in the Trash should not drag attachment pages down with them.

Props ericlewis.
Fixes #14639.

File:
1 edited

Legend:

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

    r28788 r28791  
    837837
    838838        // Inherit status from the parent
    839         if ( $post->post_parent && ( $post->ID != $post->post_parent ) )
    840             return get_post_status($post->post_parent);
     839        if ( $post->post_parent && ( $post->ID != $post->post_parent ) ) {
     840            $parent_post_status = get_post_status( $post->post_parent );
     841            if ( 'trash' == $parent_post_status ) {
     842                return get_post_meta( $post->post_parent, '_wp_trash_meta_status', true );
     843            } else {
     844                return $parent_post_status;
     845            }
     846        }
     847
    841848    }
    842849
     
    32443251        $wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where );
    32453252    }
    3246    
     3253
    32473254    if ( 'attachment' === $postarr['post_type'] ) {
    32483255        if ( ! empty( $postarr['file'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.