- if ( ('attachment' == $post->post_type) && $post->post_parent && ($post->ID != $post->post_parent) )
- return get_post_status($post->post_parent);
+ // Unattached attachments are assumed to be published
+ if ( ( 'inherit' == $post->post_status ) && ( 0 == $post->post_parent) )
+ return 'publish';
+
+ // Inherit status from the parent
+ if ( $post->post_parent && ( $post->ID != $post->post_parent ) )
+ return get_post_status($post->post_parent);
+ }