---
title: "lzb/plugin_url"
description: "lzb/plugin_url changes the base URL of the Lazy Blocks scripts and styles, to serve the plugin's assets from a CDN. Keep the trailing slash on the value."
url: "https://www.lazyblocks.com/docs/php-filters/lzb-plugin_url/"
lastUpdated: 2026-09-23
source: "php-filters/lzb-plugin_url.mdx"
---
# lzb/plugin_url

Moves the URL Lazy Blocks builds its own script and style tags from, which is what serving the plugin's assets from a CDN needs.

The default is `plugin_dir_url()` of the core plugin file, ending in a slash. `LazyBlocks_Assets::register_script()` and `register_style()` append a build path and an extension to it, so `build/editor.js` and `build/editor.css` are resolved against whatever this filter returns. The file contents are never read through this value. That is [lzb/plugin_path](https://www.lazyblocks.com/docs/php-filters/lzb-plugin_path/), which is why a wrong URL here costs a 404 on the editor bundle rather than a fatal error.

## Attributes

| Name          | Type       | Description                              |
| ------------- | ---------- | ---------------------------------------- |
| `$plugin_url` | **String** | plugin folder URL, with a trailing slash |

## Usage

```php title="PHP"
function my_lzb_plugin_url( $plugin_url ) {
  // Serve the plugin's built CSS and JS from a CDN mirror of wp-content.
  return str_replace( content_url(), 'https://cdn.example.com/wp-content', $plugin_url );
}

add_filter( 'lzb/plugin_url', 'my_lzb_plugin_url' );
```

A return value without the trailing slash produces URLs like `.../lazy-blocksbuild/editor.js`, so keep it or add it back with `trailingslashit()`. Asset version strings still come from the `.asset.php` files on disk, read through `lzb/plugin_path`, which means a CDN copy has to match the installed build or the browser caches the wrong file against the right version.

The Pro plugin has its own directory and its own filter, [lzb_pro/plugin_url](https://www.lazyblocks.com/docs/php-filters/lzb_pro-plugin_url/). Filtering one leaves the other alone.

## Documentation Index
> Fetch the complete documentation index at: https://www.lazyblocks.com/llms.txt
> Fetch every page in a single file at: https://www.lazyblocks.com/llms-full.txt
