Created
November 20, 2018 13:32
-
-
Save camaleaun/a37851686144927ce7b2dacdb005410e to your computer and use it in GitHub Desktop.
Register commands to run through WP-CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( defined( 'WP_CLI' ) && WP_CLI ) { | |
WP_CLI::add_hook( 'after_wp_load', 'pluginname_cli_runner' ); | |
} | |
function pluginname_test() { | |
WP_CLI::success( 'Command works.' ); | |
} | |
function pluginname_cli_runner() { | |
WP_CLI::add_command( 'pluginname test', 'pluginname_test' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment