Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: image_sideload_extensions

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
1005            *  - `jpe`
1006            *  - `png`
1007            *  - `gif`
1008            *
1009            * @since 5.6.0
1010            *
1011            * @param string[] $allowed_extensions Array of allowed file extensions.
1012            * @param string   $file               The URL of the image to download.
1013            */
1014           $allowed_extensions = apply_filters( 'image_sideload_extensions', $allowed_extensions, $file );
1015           $allowed_extensions = array_map( 'preg_quote', $allowed_extensions );
1016
1017           // Set variables for storage, fix file filename for query strings.
1018           preg_match( '/[^\?]+\.(' . implode( '|', $allowed_extensions ) . ')\b/i', $file, $matches );
1019
1020           if ( ! $matches ) {
1021                return new WP_Error( 'image_sideload_failed', __( 'Invalid image URL.' ) );
1022           }
1023