Make WordPress Core

Changeset 14087


Ignore:
Timestamp:
04/14/2010 03:20:15 PM (15 years ago)
Author:
ryan
Message:

Assume unattached attachments are published. fixes #12999

File:
1 edited

Legend:

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

    r14086 r14087  
    469469    $post = get_post($ID);
    470470
    471     if ( is_object($post) ) {
    472         if ( ('attachment' == $post->post_type) && $post->post_parent && ($post->ID != $post->post_parent) )
    473             return get_post_status($post->post_parent);
    474         else
    475             return $post->post_status;
    476     }
    477 
    478     return false;
     471    if ( !is_object($post) )
     472        return false;
     473
     474    // Unattached attachments are assumed to be published.
     475    if ( ('attachment' == $post->post_type) && ('inherit' == $post->post_status) && ( 0 == $post->post_parent) )
     476        return 'publish';
     477
     478    if ( ('attachment' == $post->post_type) && $post->post_parent && ($post->ID != $post->post_parent) )
     479        return get_post_status($post->post_parent);
     480
     481    return $post->post_status;
    479482}
    480483
Note: See TracChangeset for help on using the changeset viewer.