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 |
---|---|
869 |
|
870 | /** |
871 | * Fires after the header image is set or an error is returned. |
872 | * |
873 | * @since 2.1.0 |
874 | * |
875 | * @param string $file Path to the file. |
876 | * @param int $attachment_id Attachment ID. |
877 | */ |
878 | do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication. |
879 |
|
880 | return $this->finished(); |
881 | } elseif ( $width > $max_width ) { |
882 | $oitar = $width / $max_width; |
883 |
|
884 | $image = wp_crop_image( |
885 | $attachment_id, |
886 | 0, |
887 | 0, |
Line | Code |
892 | false, |
893 | str_replace( wp_basename( $file ), 'midsize-' . wp_basename( $file ), $file ) |
894 | ); |
895 |
|
896 | if ( ! $image || is_wp_error( $image ) ) { |
897 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
898 | } |
899 |
|
900 | /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ |
901 | $image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication. |
902 |
|
903 | $url = str_replace( wp_basename( $url ), wp_basename( $image ), $url ); |
904 | $width = $width / $oitar; |
905 | $height = $height / $oitar; |
906 | } else { |
907 | $oitar = 1; |
908 | } |
909 | ?> |
910 |
|
Line | Code |
1051 | } else { |
1052 | $cropped = get_attached_file( $attachment_id ); |
1053 | } |
1054 |
|
1055 | if ( ! $cropped || is_wp_error( $cropped ) ) { |
1056 | wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) ); |
1057 | } |
1058 |
|
1059 | /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ |
1060 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. |
1061 |
|
1062 | $attachment = $this->create_attachment_object( $cropped, $attachment_id ); |
1063 |
|
1064 | if ( ! empty( $_POST['create-new-attachment'] ) ) { |
1065 | unset( $attachment['ID'] ); |
1066 | } |
1067 |
|
1068 | // Update the attachment. |
1069 | $attachment_id = $this->insert_attachment( $attachment, $cropped ); |
Line | Code |
1394 | (int) $dimensions['dst_width'], |
1395 | (int) $dimensions['dst_height'] |
1396 | ); |
1397 |
|
1398 | if ( ! $cropped || is_wp_error( $cropped ) ) { |
1399 | wp_send_json_error( array( 'message' => __( 'Image could not be processed. Please go back and try again.' ) ) ); |
1400 | } |
1401 |
|
1402 | /** This filter is documented in wp-admin/includes/class-custom-image-header.php */ |
1403 | $cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication. |
1404 |
|
1405 | $attachment = $this->create_attachment_object( $cropped, $attachment_id ); |
1406 |
|
1407 | $previous = $this->get_previous_crop( $attachment ); |
1408 |
|
1409 | if ( $previous ) { |
1410 | $attachment['ID'] = $previous; |
1411 | } else { |
1412 | unset( $attachment['ID'] ); |