get_attached_file WordPress Filter Hook
The get_attached_file hook is used to retrieve the path to a file that has been attached to a post. This can be useful for doing things like displaying the attached file in the front end or for getting the path to the file so that it can be processed in some way.
apply_filters( 'get_attached_file', string|false $file , int $attachment_id ) #
Filters the attached file based on the given ID.
Parameters
- $file
(string|false)The file path to where the attached file should be, false otherwise.
- $attachment_id
(int)Attachment ID.
Source
File: wp-includes/post.php
Changelog
Version | Description |
---|---|
2.1.0 | Introduced. |