---
title: "lzb/plugin_basename"
description: "PHP filter `lzb/plugin_basename` of the Lazy Blocks WordPress plugin."
url: "https://www.lazyblocks.com/docs/php-filters/lzb-plugin_basename/"
source: "php-filters/lzb-plugin_basename.mdx"
---
# lzb/plugin_basename

Filters the `folder/file.php` identifier WordPress knows the plugin by.

The plugin uses this string to find its own `languages` directory and to attach the Plugins screen action link. A site that ships Lazy Blocks inside a theme or a parent plugin, where the directory name differs from the one WordPress recorded, corrects it here.

## Attributes

| Name               | Type       | Description                                                                                                |
| ------------------ | ---------- | ---------------------------------------------------------------------------------------------------------- |
| `$plugin_basename` | **String** | `plugin_basename( __FILE__ )` of the core plugin file, `lazy-blocks/lazy-blocks.php` in a standard install |

Two places read it:

| Where                              | What it uses the value for                                                      |
| ---------------------------------- | ------------------------------------------------------------------------------- |
| `load_plugin_textdomain()`         | `dirname()` of the value plus `/languages/`, the folder scanned for `.mo` files |
| `plugin_action_links_` filter name | the Plugins screen row the Go Pro link is attached to                           |

## Usage

```php title="PHP"
function my_lzb_plugin_basename( $plugin_basename ) {
  // Lazy Blocks lives in a subfolder of this plugin, so the basename
  // WordPress recorded points at the wrong directory.
  return 'acme-blocks/vendor/lazy-blocks/lazy-blocks.php';
}

add_filter( 'lzb/plugin_basename', 'my_lzb_plugin_basename' );
```

Nothing validates the returned string. A wrong value makes `load_plugin_textdomain()` look in a directory that does not exist, and every Lazy Blocks string falls back to English with no error anywhere. The Go Pro link on the Plugins screen disappears at the same time, which is the fastest way to spot it.

The two consumers read the value at different times. `load_plugin_textdomain()` runs on `init` at priority 5, so a filter registered on `plugins_loaded` is early enough for translations. The Plugins screen filter name is built while the plugin file itself is loading, so only a must-use plugin can change that one.

See also [lzb/plugin_path](https://www.lazyblocks.com/docs/php-filters/lzb-plugin_path/) and [lzb/plugin_url](https://www.lazyblocks.com/docs/php-filters/lzb-plugin_url/).

## 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
