wp_save_image_file
Устарел с версии 3.5.0. Больше не поддерживается и может быть удален. Смотрите wp_save_image_editor_file.
Filters whether to skip saving the image file.
Returning a non-null value will short-circuit the save method, returning that value instead.
Использование
add_filter( 'wp_save_image_file', 'wp_kama_save_image_file_filter', 10, 3 );
/**
* Function for `wp_save_image_file` filter-hook.
*
* @param bool|null $override Value to return instead of saving.
* @param string $filename Name of the file to be saved.
* @param resource|GdImage $image Image resource or GdImage instance.
*
* @return bool|null
*/
function wp_kama_save_image_file_filter( $override, $filename, $image ){
// filter...
return $override;
}
- $override(true|false|null)
- Value to return instead of saving.
По умолчанию: null - $filename(строка)
- Name of the file to be saved.
- $image(resource|GdImage)
- Image resource or GdImage instance.
Список изменений
| С версии 2.9.0 | Введена. |
| Устарела с 3.5.0 | Use {@see 'wp_save_image_editor_file'} instead. |
Где вызывается хук
wp-admin/includes/image-edit.php 479-484
$saved = apply_filters_deprecated( 'wp_save_image_file', array( null, $filename, $image, $mime_type, $post_id ), '3.5.0', 'wp_save_image_editor_file' );