Automattic\WooCommerce\Internal\ProductFeed\Storage

JsonFileFeed::get_file_url_for_identifier │ public static │ WC 11.2.0

Builds the current URL for a feed identifier.

Method of the class: JsonFileFeed{}

No Hooks.

Returns

string|null. The feed URL, or null if the identifier is invalid.

Usage

$result = JsonFileFeed::get_file_url_for_identifier( $identifier ): ?string;
$identifier(string) (required)
The feed file identifier.

Changelog

Since 11.2.0 Introduced.

JsonFileFeed::get_file_url_for_identifier() code WC 11.3.0

public static function get_file_url_for_identifier( string $identifier ): ?string {
	if ( ! self::is_valid_feed_identifier( $identifier ) ) {
		return null;
	}

	$upload_dir    = wp_upload_dir( null, false, true );
	$directory_url = self::build_directory_url( untrailingslashit( $upload_dir['baseurl'] ) );
	return self::build_file_url( $directory_url, rawurlencode( $identifier ) );
}