Make WordPress Core

Ticket #12306: post.php.2.diff

File post.php.2.diff, 677 bytes (added by jfarthing84, 15 years ago)

This one is the second method of checking for an inherit_type of 'attachment'

  • post.php

     
    34053405
    34063406        if ( empty($url) ) //If any of the above options failed, Fallback on the GUID as used pre-2.7, not recomended to rely upon this.
    34073407                $url = get_the_guid( $post->ID );
     3408               
     3409        $attachment_types = array_merge( array('attachment'), get_post_types( array('inherit_type' => 'attachment') ) );
    34083410
    3409         if ( 'attachment' != $post->post_type || empty($url) )
     3411        if ( ! in_array($post->post_type, $attachment_types) || empty($url) )
    34103412                return false;
    34113413
    34123414        return apply_filters( 'wp_get_attachment_url', $url, $post->ID );