WordPress.org

Make WordPress Core

Ticket #24390: 24390.patch

File 24390.patch, 1.1 KB (added by obenland, 11 months ago)
  • wp-includes/media.php

     
    23692369} 
    23702370 
    23712371/** 
    2372  * Check a specified post's content for gallery and, if present, return the first 
     2372 * Check a specified post's content for gallery and, if present, return the first. 
    23732373 * 
    23742374 * @since 3.6.0 
    23752375 * 
    23762376 * @param int $post_id Optional. Post ID. 
    2377  * @param boolean $html Whether to return HTML or data 
    2378  * @return array Gallery data and srcs parsed from the expanded shortcode 
     2377 * @param boolean $html Whether to return HTML or data. 
     2378 * @return string|array Gallery html or data and srcs parsed from the expanded shortcode. 
    23792379 */ 
    23802380function get_post_gallery( $post_id = 0, $html = true ) { 
    23812381        if ( ! $post = get_post( $post_id ) ) 
    2382                 return array(); 
     2382                return $html ? '' : array(); 
    23832383 
    23842384        if ( ! has_shortcode( $post->post_content, 'gallery' ) ) 
    2385                 return array(); 
     2385                return $html ? '' : array(); 
    23862386 
    23872387        $data = get_content_galleries( $post->post_content, $html, false, 1 ); 
    23882388        return reset( $data );