remove_block_asset_path_prefix() – Removes the block asset’s path prefix if provided.

You appear to be a bot. Output may be restricted

Description

Removes the block asset's path prefix if provided.

Usage

$string = remove_block_asset_path_prefix( $asset_handle_or_path );

Parameters

$asset_handle_or_path
( string ) required – Asset handle or prefixed path.

Returns

string Path without the prefix or the original value.

Source

File name: wordpress/wp-includes/blocks.php
Lines:

1 to 14 of 14
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;
}
 

 View on GitHub View on Trac