get_attached_file
Filters the attached file based on the given ID.
Использование
add_filter( 'get_attached_file', 'wp_kama_get_attached_file_filter', 10, 2 );
/**
* Function for `get_attached_file` filter-hook.
*
* @param string|false $file The file path to where the attached file should be, false otherwise.
* @param int $attachment_id Attachment ID.
*
* @return string|false
*/
function wp_kama_get_attached_file_filter( $file, $attachment_id ){
// filter...
return $file;
}
- $file(строка|false)
- The file path to where the attached file should be, false otherwise.
- $attachment_id(int)
- Attachment ID.
Список изменений
| С версии 2.1.0 | Введена. |
Где вызывается хук
get_attached_file
wp-includes/post.php 868
return apply_filters( 'get_attached_file', $file, $attachment_id );