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