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 4 times in this file.
| Line | Code |
|---|---|
| 809 | |
| 810 | /** |
| 811 | * Fires after the header image is set or an error is returned. |
| 812 | * |
| 813 | * @since 2.1.0 |
| 814 | * |
| 815 | * @param string $file Path to the file. |
| 816 | * @param int $attachment_id Attachment ID. |
| 817 | */ |
| 818 | do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication |
| 819 | |
| 820 | return $this->finished(); |
| 821 | } elseif ( $width > $max_width ) { |
| 822 | $oitar = $width / $max_width; |
| 823 | $image = wp_crop_image( $attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace( basename( $file ), 'midsize-' . basename( $file ), $file ) ); |
| 824 | if ( ! $image || is_wp_error( $image ) ) { |
| 825 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
| 826 | } |
| 827 | |
| 828 | /** This filter is documented in wp-admin/custom-header.php */ |
| 829 | $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication |
| 830 | |
| 831 | $url = str_replace( basename( $url ), basename( $image ), $url ); |
| 832 | $width = $width / $oitar; |
| 833 | $height = $height / $oitar; |
| 834 | } else { |
| 835 | $oitar = 1; |
| 836 | } |
| 837 | ?> |
| 838 | |
| Line | Code |
| 963 | } else { |
| 964 | $cropped = get_attached_file( $attachment_id ); |
| 965 | } |
| 966 | |
| 967 | if ( ! $cropped || is_wp_error( $cropped ) ) { |
| 968 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
| 969 | } |
| 970 | |
| 971 | /** This filter is documented in wp-admin/custom-header.php */ |
| 972 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication |
| 973 | |
| 974 | $object = $this->create_attachment_object( $cropped, $attachment_id ); |
| 975 | |
| 976 | if ( ! empty( $_POST['create-new-attachment'] ) ) { |
| 977 | unset( $object['ID'] ); |
| 978 | } |
| 979 | |
| 980 | // Update the attachment |
| 981 | $attachment_id = $this->insert_attachment( $object, $cropped ); |
| Line | Code |
| 1299 | (int) $dimensions['dst_width'], |
| 1300 | (int) $dimensions['dst_height'] |
| 1301 | ); |
| 1302 | |
| 1303 | if ( ! $cropped || is_wp_error( $cropped ) ) { |
| 1304 | wp_send_json_error( array( 'message' => __( 'Image could not be processed. Please go back and try again.' ) ) ); |
| 1305 | } |
| 1306 | |
| 1307 | /** This filter is documented in wp-admin/custom-header.php */ |
| 1308 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication |
| 1309 | |
| 1310 | $object = $this->create_attachment_object( $cropped, $attachment_id ); |
| 1311 | |
| 1312 | $previous = $this->get_previous_crop( $object ); |
| 1313 | |
| 1314 | if ( $previous ) { |
| 1315 | $object['ID'] = $previous; |
| 1316 | } else { |
| 1317 | unset( $object['ID'] ); |