public static function Run() {
The “static” here means this function doesn’t have an object context i.e. it’s intended to be called as Block::Run()
without actually making a Block. That said, $block = new Block(); $block->Run();
will still work, but it still doesn’t have $this set inside the method.
Instead you can use the class name instead of $this to make a callable for a static method:
class Block{
public static function Run() {
add_action('enqueue_block_editor_assets', array('Block', 'RegisterBlock') );
But I’ve no idea how the original code is working in wp-admin. Is it code definitely being called?
Related Posts:
- WP CLI “Error establishing a database connection” in localhost (MAMP)
- wp-cli Enabling Maintainance Mode
- How do I run a PHP script from WordPress environment, like `wp shell`?
- Using wp-cli can I not query pages by their title?
- WP-CLI Cannot Connect to Database due to Vagrant
- Changing the WP CLI cache folder
- WP-CLI Process Killed
- wp-cli commands do nothing, return nothing
- Enable Auto-updates for all plugins using wp-cli? (since wordpress 5.5)
- How do I clone or duplicate a post with the WordPress Command Line Interface WP-CLI?
- WP-CLI get all posts from certain post type and taxonomy term
- Does wp post delete also delete metadata associated with posts?
- WP-CLI :: Cannot installing plugin as www-data
- WP-CLI works on non WP-CLI installed WordPress instance?
- Export list of users with first and lastname in WP-CLI
- WP-CLI – Return posts with matching meta key
- Prompt user for input in WP CLI
- WP-CLI throwing PHP Fatal error: Call to undefined function apply_filters() [closed]
- WPCLI – update plugins, themes, and core, all in one row, instead 3 rows?
- Revert WordPress default options after a PHPUnit test has run
- Can I create multiple pages at once using WP-CLI?
- WP-CLI update date and time format
- wp-cli create post and media import
- What is the difference between the Package Language and the Site Language?
- WP CLI – show users whose ID is larger than given ID
- How do I update a nested option?
- Wp-cli-ssh global installation problem [closed]
- WP-CLI with theme: Uncaught Error: Class ‘WP_CLI’ not found
- WPCLI search and replace variants for all tables
- Can I create (or update) user password with WP-CLI by hash?
- Is there a way to pre-cache plugins with WP-CLI for faster installation?
- Allow download_url for lan addresses
- How to prevent WP-CLI shell from exiting when an exception occurs?
- WP-CLI Get Site ID from its url
- WP-CLI alias: connect with ssh proxy
- Execute wp-cli command on all sites on server
- Ask WP-CLI latest core WordPress version released
- How to change a post attribute to homepage using WP CLI?
- Unable to install plugins from wp-cli
- WP-CLI sudden empty response
- How to get all posts related to a term with WP-CLI?
- How to verify a correct wp-cli installation?
- How can I add an RSS widget using WP-CLI?
- Shortest way to install WP-CLI
- Uninstall WP-CLI
- Get last published post in WordPress using wp-cli
- WP Cli will not execute on Windows
- Formatting messed up when piping wp commands
- Where do the files of a custom WP CLI Command reside?
- wp-cli configuration in php?
- Does WP-CLI support updating multiple options via a single command?
- How to use wp db export and import together?
- How to find what pages/posts contain a particular reusable block?
- WP CLI not finding plugin commands
- How can I search and replace by post type?
- Only the WP CLI command, wp –info, runs under my cPanel account
- Error establishing a database connection when running phpunit
- Set Site Icon programmatically (eg. using `wp cli`)
- Specify custom php.ini to use with WP-CLI
- How to rename default category name and slug using WP CLI?
- Resetting internal WordPress state during its cycle
- How do I add HTML code to a widget with wp-cli?
- Wildcard for wp-cli search-replace
- Update BackupBuddy with WP-CLI
- Is resetting post data necessary with custom WP_CLI commands?
- Get media url (featured image) with wp-cli
- Can I use wp-cli to create posts with a custom post types?
- Do all WordPress installations include WP CLI by default
- Why doesn’t ‘wp’ command work in my WP-CLI installation?
- WP CLI allowed fields?
- WP-CLI unable to recongnise PHP server / environment variables on Ubuntu
- How to move back a command in WP-CLI from wp shell?
- wp_clear_object_cache() is deprecated. What should I use instead?
- WP-CLI media import error
- How best to keep my localhost on Http while my Remote production is on Https
- Can’t Connect to MySQL Database using WP CLI and MAMP on a macOS Catalina, using Oh My Zsh
- Is it possible to view WP documentation within the WordPress shell?
- Userless db-only wordpress instalation
- WPCLI doesn’t recognize the site
- Combine WPCLI commands for plugin installation and activation?
- Add passwords to config.yml to manage multiple sites
- What user should I use for wp-cli on Ubuntu VPS [closed]
- Working with CLI and missing my namespace classes inside
- WP CLI: critical error on your website
- WP-CLI plugin activate – ‘activate’ is not a registered subcommand of ‘plugin’
- WP changes siteurl, but some URLs then don’t work
- Creating a subcommand for custom wp-cli command
- Install plugin on remote wordpress
- WP-CLI – How to install a plugin from a remote server
- How to fix “Not enough memory” on Windows 7 and PHP 7.2.0 (cli)
- Make WordPress more like Jekyll (using wp-cli package?)
- Find latest/published version of post using wp-cli
- Wp-cli from a plugin?
- Is it possible to update a single page using WP-CLI?
- undefined function apache_request_headers()
- ignoring, hidding mu plugins when wp-cli is run
- WP-CLi Uable to Install / Update Plugins
- wp-cli incorrectly believes a plugin is currently installed
- Using wp-cli on remote with quoted commands
- Post Count for Multisite?