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.


Top ↑

Source

File: wp-includes/post.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More