lzb_pro/plugin_path
Filters the absolute path Lazy Blocks Pro loads its own class files and build assets from.
The Pro plugin bundled inside a theme or a parent plugin sits somewhere plugin_dir_path( __FILE__ ) still reports correctly, so this filter is rarely needed. It exists as the counterpart of lzb_pro/plugin_url, for a setup that moves the files after the plugin header has been read.
Attributes
| Name | Type | Description |
|---|---|---|
$plugin_path | String | plugin_dir_path( __FILE__ ) of lazy-blocks-pro.php, with a trailing slash |
Three things read it:
| Where | What it loads |
|---|---|
init_options() | every classes/class-*.php file the plugin needs |
include_control_dependencies() | the Pro control classes, on lzb/init at priority 6 |
Lazy_Blocks_Pro_Assets | the .asset.php files holding each script's dependencies and version |
Usage
// In a must-use plugin, so it is registered before Lazy Blocks Pro loads.
function my_lzb_pro_plugin_path( $plugin_path ) {
return WP_CONTENT_DIR . '/vendor/lazy-blocks-pro/';
}
add_filter( 'lzb_pro/plugin_path', 'my_lzb_pro_plugin_path' );The plugin builds its require_once calls from this value, so a path that does not exist is a fatal error rather than a missing feature. Keep the trailing slash: the code concatenates the value with classes/class-assets.php and similar relative paths.
init_options() runs while the plugin file itself is loading, before plugins_loaded, so a filter registered from a normal plugin or from a theme is too late for the first block of require_once calls. Only a must-use plugin runs early enough. The control dependencies loaded on lzb/init see the filter whenever it was added.
Changing the asset URL is a different filter, lzb_pro/plugin_url, and Include Lazy Blocks within theme or plugin sets that one for you.