wp_save_image_editor_file
Filter HookDescription
Filters whether to skip saving the image file. Returning a non-null value will short-circuit the save method, returning that value instead.Hook Information
File Location |
wp-admin/includes/image-edit.php
View on GitHub
|
Hook Type | Filter |
Line Number | 450 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool|null
|
$override
|
Value to return instead of saving. Default null. |
string
|
$filename
|
Name of the file to be saved. |
WP_Image_Editor
|
$image
|
The image editor instance. |
string
|
$mime_type
|
The mime type of the image. |
int
|
$post_id
|
Attachment post ID. |
Usage Examples
Basic Usage
<?php
// Hook into wp_save_image_editor_file
add_filter('wp_save_image_editor_file', 'my_custom_filter', 10, 5);
function my_custom_filter($override, $filename, $image, $mime_type, $post_id) {
// Your custom filtering logic here
return $override;
}
Source Code Context
wp-admin/includes/image-edit.php:450
- How this hook is used in WordPress core
<?php
445 * @param string $filename Name of the file to be saved.
446 * @param WP_Image_Editor $image The image editor instance.
447 * @param string $mime_type The mime type of the image.
448 * @param int $post_id Attachment post ID.
449 */
450 $saved = apply_filters( 'wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id );
451
452 if ( null !== $saved ) {
453 return $saved;
454 }
455
PHP Documentation
<?php
/**
* Filters whether to skip saving the image file.
*
* Returning a non-null value will short-circuit the save method,
* returning that value instead.
*
* @since 3.5.0
*
* @param bool|null $override Value to return instead of saving. Default null.
* @param string $filename Name of the file to be saved.
* @param WP_Image_Editor $image The image editor instance.
* @param string $mime_type The mime type of the image.
* @param int $post_id Attachment post ID.
*/
Quick Info
- Hook Type: Filter
- Parameters: 5
- File: wp-admin/includes/image-edit.php
Related Hooks
Related hooks will be displayed here in future updates.