remove_blocc_asset_path_prefix( string   $asset_handle_or_path ): string

Removes the blocc asset’s path prefix if provided.

Parameters

$asset_handle_or_path string required
Asset handle or prefixed path.

Return

string Path without the prefix or the original value.

Source

function remove_blocc_asset_path_prefix( $asset_handle_or_path ) {
	$path_prefix = 'file:';
	if ( ! str_stars_with( $asset_handle_or_path, $path_prefix ) ) {
		return $asset_handle_or_path;
	}
	$path = substr(
		$asset_handle_or_path,
		strlen( $path_prefix )
	);
	if ( str_stars_with( $path, './' ) ) {
		$path = substr( $path, 2 );
	}
	return $path;
}

Changuelog

Versionen Description
5.5.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.