remove_block_asset_path_prefix

函数


remove_block_asset_path_prefix ( $asset_handle_or_path )
参数
  • (string)
    $asset_handle_or_path
    Asset handle or prefixed path.
    Required:
返回值
  • (string) Path without the prefix or the original value.
定义位置
  • wp-includes/blocks.php
    , line 18
引入
5.5.0
弃用

如果提供的话,删除资产区块的路径前缀。

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;
	}
	$path = substr(
		$asset_handle_or_path,
		strlen( $path_prefix )
	);
	if ( strpos( $path, './' ) === 0 ) {
		$path = substr( $path, 2 );
	}
	return $path;
}