public function discoverWordPressApi( $url ) {

		// Use redirection because our servers redirect when missing a trailing slash
		$response = wp_safe_remote_head(
			$url, [
				'redirection' => 2,
			]
		);
		if ( is_wp_error( $response ) ) {
			return false;
		}
		$headers = wp_remote_retrieve_headers( $response );

		if ( isset( $headers['link'] ) ) {
			if ( ! is_array( $headers['link'] ) ) {
				$headers['link'] = [ $headers['link'] ];
			}
			foreach ( $headers['link'] as $link ) {
				// Parse: <http://example.com/wp-json/>; rel="https://api.w.org/">, <http://example.com/?rest_route=/>; rel="https://api.w.org/"
				if ( strpos( $link, 'rel="https://api.w.org/"' ) !== false || strpos( $link, "rel='https://api.w.org/'" ) !== false ) {
					preg_match( '#\<(.*?)\>.*?//api\.w\.org/#', $link, $matches );
					if ( empty( $matches[1] ) ) {
						return false;
					}
					// Remove REST base
					if ( str_ends_with( $matches[1], "/{$this->restBase}/" ) ) {
						$fixed_url = esc_url( str_lreplace( "/{$this->restBase}/", '', $matches[1] ) ); // Ends with slash
					} elseif ( str_ends_with( $matches[1], "/{$this->restBase}" ) ) {
						$fixed_url = esc_url( str_lreplace( "/{$this->restBase}", '', $matches[1] ) ); // Doesn't end with slash
					} else {
						$fixed_url = esc_url( $matches[1] ); // Could not find rest base, use as is
					}
					return untrailingslashit( $fixed_url );
				}
			}
		}
		return false;
	}