Languages: English • 日本語 (Add your language)
Retrieve attached file path based on attachment ID.
You can optionally send it through the 'get_attached_file' filter, but by default it will just return the file path unfiltered.
The function works by getting the single post meta name, named '_wp_attached_file' and returning it. This is a convenience function to prevent looking up the meta name and provide a mechanism for sending the attached file name through a filter.
<?php get_attached_file( $attachment_id, $unfiltered ); ?>
$fullsize_path = get_attached_file( $attachment_id ); // Full path
Since: 2.0.0
get_attached_file() is located in wp-includes/post.php
.
Attachment Functions:
get_children(), get attached media(), the_attachment_link(), get_attachment_link(), wp_get_attachment_link(), wp_get_attachment_image(), wp_get_attachment_image_src(), wp_get_attachment_url(), wp_get_attachment_thumb_file(), wp_get_attachment_thumb_url(), is_attachment(), wp_get_attachment_metadata()