wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_get_original_image_url › WordPress Function
Since5.3.0
Deprecatedn/a
› wp_get_original_image_url ( $attachment_id )
Parameters: |
|
Returns: |
|
Defined at: |
|
Codex: |
Retrieves the URL to an original attachment image.
Similar towp_get_attachment_url()
however some images may have been
processed after uploading. In this case this function returns the URL
to the originally uploaded image file.Source
function wp_get_original_image_url( $attachment_id ) { if ( ! wp_attachment_is_image( $attachment_id ) ) { return false; } $image_url = wp_get_attachment_url( $attachment_id ); if ( ! $image_url ) { return false; } $image_meta = wp_get_attachment_metadata( $attachment_id ); if ( empty( $image_meta['original_image'] ) ) { $original_image_url = $image_url; } else { $original_image_url = path_join( dirname( $image_url ), $image_meta['original_image'] ); } /** * Filters the URL to the original attachment image. * * @since 5.3.0 * * @param string $original_image_url URL to original image. * @param int $attachment_id Attachment ID. */ return apply_filters( 'wp_get_original_image_url', $original_image_url, $attachment_id ); }