From 5e923222fa35fd8124b7d5afb2ab3d7237977241 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 14 Apr 2010 15:20:15 +0000 Subject: [PATCH] Assume unattached attachments are published. fixes #12999 git-svn-id: http://svn.automattic.com/wordpress/trunk@14087 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 10148a40b4..bb40c2bcc0 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -468,14 +468,17 @@ function get_post_mime_type($ID = '') { function get_post_status($ID = '') { $post = get_post($ID); - if ( is_object($post) ) { - if ( ('attachment' == $post->post_type) && $post->post_parent && ($post->ID != $post->post_parent) ) - return get_post_status($post->post_parent); - else - return $post->post_status; - } + if ( !is_object($post) ) + return false; - return false; + // Unattached attachments are assumed to be published. + if ( ('attachment' == $post->post_type) && ('inherit' == $post->post_status) && ( 0 == $post->post_parent) ) + return 'publish'; + + if ( ('attachment' == $post->post_type) && $post->post_parent && ($post->ID != $post->post_parent) ) + return get_post_status($post->post_parent); + + return $post->post_status; } /**