. return preg_replace_callback( '~"\']++|"[^"]*+"|\'[^\']*+\')*>~i', static function( $match ) { $attributes = wp_kses_hair( substr( $match[0], 7, -1 ), wp_allowed_protocols() ); $sources = array(); foreach ( $attributes as $name => $attribute ) { if ( strtolower( $name ) === 'src' ) { $sources[] = $attribute['value']; } } if ( empty( $sources ) ) { return $match[0]; } if ( count( $sources ) !== 1 ) { return '