Skip to content
PHP Filters

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

NameTypeDescription
$plugin_basenameStringplugin_basename( __FILE__ ) of the core plugin file, lazy-blocks/lazy-blocks.php in a standard install

Two places read it:

WhereWhat it uses the value for
load_plugin_textdomain()dirname() of the value plus /languages/, the folder scanned for .mo files
plugin_action_links_ filter namethe Plugins screen row the Go Pro link is attached to

Usage

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 and lzb/plugin_url.

Was this article helpful?

Copyright © 2026 Lazy Blocks.