A WordPress-centric search engine for devs and theme authors



remove_block_asset_path_prefix ›

Since5.5.0
Deprecatedn/a
remove_block_asset_path_prefix ( $asset_handle_or_path )
Parameters:
  • (string) $asset_handle_or_path Asset handle or prefixed path.
    Required: Yes
Returns:
  • (string) Path without the prefix or the original value.
Defined at:
Codex:

Removes the block asset's path prefix if provided.



Source

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 )
	);
}