remove_block_asset_path_prefix()

最后更新于:2021-11-27 21:41:13

remove_block_asset_path_prefix( string$asset_handle_or_path)

Removes the block asset’s path prefix if provided.

参数

$asset_handle_or_path

(string) (Required) Asset handle or prefixed path.

响应

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

源文件

文件: gc-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 )
	);
}