update_attached_file

update_attached_file

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.4.3

apply_filters('update_attached_file') is found 1 times:

  • /wp-includes/post.php line 803
    	 *
    	 * @param string $file          Path to the attached file to update.
    	 * @param int    $attachment_id Attachment ID.
    	 */
    	$file = apply_filters( 'update_attached_file', $file, $attachment_id );
    
    	$file = _wp_relative_upload_path( $file );
    	if ( $file ) {
    		return update_post_meta( $attachment_id, '_wp_attached_file', $file );
    	} else {
    		return delete_post_meta( $attachment_id, '_wp_attached_file' );
    

See this hook used in plugins: