WordPress.org

Make WordPress Core

Ticket #17579: 17579.diff

File 17579.diff, 642 bytes (added by mitchoyoshitaka, 7 years ago)
  • wp-includes/post.php

     
    38393839 */
    38403840function wp_get_attachment_url( $post_id = 0 ) {
    38413841        $post_id = (int) $post_id;
    3842         if ( !$post =& get_post( $post_id ) )
     3842        if ( !$post =& get_post( $post_id ) || 'attachment' != $post->post_type )
    38433843                return false;
    38443844
    38453845        $url = '';
     
    38593859
    38603860        $url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );
    38613861
    3862         if ( 'attachment' != $post->post_type || empty( $url ) )
     3862        if ( empty( $url ) )
    38633863                return false;
    38643864
    38653865        return $url;