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.
Line | Code |
---|---|
1027 | * - `gif` |
1028 | * - `webp` |
1029 | * |
1030 | * @since 5.6.0 |
1031 | * @since 5.8.0 Added 'webp' to the default list of allowed file extensions. |
1032 | * |
1033 | * @param string[] $allowed_extensions Array of allowed file extensions. |
1034 | * @param string $file The URL of the image to download. |
1035 | */ |
1036 | $allowed_extensions = apply_filters( 'image_sideload_extensions', $allowed_extensions, $file ); |
1037 | $allowed_extensions = array_map( 'preg_quote', $allowed_extensions ); |
1038 |
|
1039 | // Set variables for storage, fix file filename for query strings. |
1040 | preg_match( '/[^\?]+\.(' . implode( '|', $allowed_extensions ) . ')\b/i', $file, $matches ); |
1041 |
|
1042 | if ( ! $matches ) { |
1043 | return new WP_Error( 'image_sideload_failed', __( 'Invalid image URL.' ) ); |
1044 | } |
1045 |
|