wphooks.info - update_attached_file

update_attached_file

(trunk - 5.1-alpha-44286)

The hook occurs in the following file:

wp-includes/post.php:
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
	}

	/**
	 * Filters the path to the attached file to update.
	 *
	 * @since 2.1.0
	 *
	 * @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 );

	if ( $file = _wp_relative_upload_path( $file ) ) {
		return update_post_meta( $attachment_id, '_wp_attached_file', $file );
	} else {
		return delete_post_meta( $attachment_id, '_wp_attached_file' );
	}
}

/**