WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
| Line | Code |
|---|---|
| 574 | $data = $backup_sizes['full-orig']; |
| 575 | |
| 576 | if ( $parts['basename'] != $data['file'] ) { |
| 577 | if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) { |
| 578 | |
| 579 | // Delete only if it's edited image. |
| 580 | if ( preg_match('/-e[0-9]{13}\./', $parts['basename']) ) { |
| 581 | |
| 582 | /** This filter is documented in wp-admin/custom-header.php */ |
| 583 | $delpath = apply_filters( 'wp_delete_file', $file ); |
| 584 | @unlink($delpath); |
| 585 | } |
| 586 | } elseif ( isset( $meta['width'], $meta['height'] ) ) { |
| 587 | $backup_sizes["full-$suffix"] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $parts['basename']); |
| 588 | } |
| 589 | } |
| 590 | |
| 591 | $restored_file = path_join($parts['dirname'], $data['file']); |
| 592 | $restored = update_attached_file($post_id, $restored_file); |
| Line | Code |
| 599 | foreach ( $default_sizes as $default_size ) { |
| 600 | if ( isset($backup_sizes["$default_size-orig"]) ) { |
| 601 | $data = $backup_sizes["$default_size-orig"]; |
| 602 | if ( isset($meta['sizes'][$default_size]) && $meta['sizes'][$default_size]['file'] != $data['file'] ) { |
| 603 | if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) { |
| 604 | |
| 605 | // Delete only if it's edited image |
| 606 | if ( preg_match('/-e[0-9]{13}-/', $meta['sizes'][$default_size]['file']) ) { |
| 607 | /** This filter is documented in wp-admin/custom-header.php */ |
| 608 | $delpath = apply_filters( 'wp_delete_file', path_join($parts['dirname'], $meta['sizes'][$default_size]['file']) ); |
| 609 | @unlink($delpath); |
| 610 | } |
| 611 | } else { |
| 612 | $backup_sizes["$default_size-{$suffix}"] = $meta['sizes'][$default_size]; |
| 613 | } |
| 614 | } |
| 615 | |
| 616 | $meta['sizes'][$default_size] = $data; |
| 617 | } else { |
| Line | Code |
| 813 | } |
| 814 | } |
| 815 | } else { |
| 816 | $delete = true; |
| 817 | } |
| 818 | |
| 819 | if ( $delete ) { |
| 820 | |
| 821 | /** This filter is documented in wp-admin/custom-header.php */ |
| 822 | $delpath = apply_filters( 'wp_delete_file', $new_path ); |
| 823 | @unlink( $delpath ); |
| 824 | } |
| 825 | |
| 826 | $return->msg = esc_js( __('Image saved') ); |
| 827 | return $return; |
| 828 | } |
| 829 | |