static protected function isUrlSmallerThanUploadMaxSize( $url, $max ) {
		$response = wp_safe_remote_head(
			$url, [
				'redirection' => 2,
			]
		);
		$size = (int) wp_remote_retrieve_header( $response, 'Content-Length' );
		if ( empty( $size ) ) {
			return true; // Unable to verify, return true and hope for the best...
		}
		return ( $max >= $size );
	}
static protected function isUrlSmallerThanUploadMaxSize( $url, $max ) {
		$response = wp_safe_remote_head(
			$url, [
				'redirection' => 2,
			]
		);
		$size = (int) wp_remote_retrieve_header( $response, 'Content-Length' );
		if ( empty( $size ) ) {
			return true; // Unable to verify, return true and hope for the best...
		}
		return ( $max >= $size );
	}
static protected function isUrlSmallerThanUploadMaxSize ( $ url , $ max ) { $ response = wp_safe_remote_head ( $ url , [ 'redirection' => 2 , ] ) ; $ size = ( int ) wp_remote_retrieve_header ( $ response , 'Content-Length' ) ; if ( empty ( $ size ) ) { return true ; // Unable to verify, return true and hope for the best... } return ( $ max >= $ size ) ; }
Check that a URL is smaller than MAX UPLOAD without downloading the file

@param string $url
@param int $max

@return bool
Check that a URL is smaller than MAX UPLOAD without downloading the file