#2763 closed defect (bug) (wontfix)
get_post_status should use post_status = inherit instead of post_type = attachment
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 2.1 |
| Component: | Administration | Keywords: | post_status attachment has-patch 2nd-opinion |
| Focuses: | Cc: |
Description
The function get_post_status gets the inherited post_status if the post_type = 'attachment', but shouldn't it test if post_status = 'inherit' instead? I'm attempting to allow attachments to be marked "private" regardless of their parent post/page's status. It's my assumption that by default, attachments have post_status = 'inherit', so changing this line shouldn't break anything.
get_post_status should be:
function get_post_status($ID = '') {
$post = get_post($ID);
if ( is_object($post) ) {
if ( ('inherit' == $post->post_status) && $post->post_parent && ($post->ID != $post->post_parent) )
return get_post_status($post->post_parent);
else
return $post->post_status;
}
return false;
}
Attachments (1)
Change History (7)
Note: See
TracTickets for help on using
tickets.
patch for wp-includes/post.php to handle post_status='inherit' and also treat post_status='publish' like 'inherit' if it has a parent page