wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes
remove_block_asset_path_prefix › WordPress Function
Depuis5.5.0
Dépréciéen/a
› remove_block_asset_path_prefix ( $asset_handle_or_path )
| Paramètres: |
|
| Retourne: |
|
| Défini(e) dans: |
|
| Codex: |
Removes the block asset's path prefix if provided.
Fonctions en relation: resolve_block_template, get_block_asset_url, generate_block_asset_handle, _resolve_home_block_template, render_block_core_pattern
Source
function remove_block_asset_path_prefix( $asset_handle_or_path ) {
$path_prefix = 'file:';
if ( ! str_starts_with( $asset_handle_or_path, $path_prefix ) ) {
return $asset_handle_or_path;
}
$path = substr(
$asset_handle_or_path,
strlen( $path_prefix )
);
if ( str_starts_with( $path, './' ) ) {
$path = substr( $path, 2 );
}
return $path;
}