remove_block_asset_path_prefix

Advertisement

Summery Summery

Removes the block asset’s path prefix if provided.

Syntax Syntax

remove_block_asset_path_prefix( string $asset_handle_or_path )

Parameters Parameters

$asset_handle_or_path

(Required) Asset handle or prefixed path.

Return Return

(string) Path without the prefix or the original value.

Source Source

File: wp-includes/blocks.php

function remove_block_asset_path_prefix( $asset_handle_or_path ) {
	$path_prefix = 'file:';
	if ( 0 !== strpos( $asset_handle_or_path, $path_prefix ) ) {
		return $asset_handle_or_path;
	}
	return substr(
		$asset_handle_or_path,
		strlen( $path_prefix )
	);
}

Advertisement

Changelog Changelog

Changelog
Version Description
5.5.0 Introduced.

Advertisement

Leave a Reply