Last active
March 3, 2021 13:50
-
-
Save vanushwashere/3ef39ad435ec5507e43e376a68831ef5 to your computer and use it in GitHub Desktop.
A 'Hello World' for WP CLI
This file contains hidden or 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
<?php | |
/* | |
Plugin Name: 10web Hello World | |
Plugin URI: https://10web.io/ | |
Description: Teaching the basics of WP-CLI | |
Author: Vanush 10web | |
Version: 1.0.0 | |
Author URI: https://10web.io/ | |
*/ | |
/** | |
* My custom command to print greeting. | |
*/ | |
class TWC_CLI { | |
/** | |
* Returns 'Hello World' | |
* | |
* @since 0.0.1 | |
* @author Vanush 10web | |
*/ | |
public function hello_world() { | |
WP_CLI::line( 'Hello World!' ); | |
} | |
} | |
/** | |
* Registers our command when cli get's initialized. | |
* | |
* @since 1.0.0 | |
* @author Vanush 10web | |
*/ | |
function twc_cli_register_commands() { | |
WP_CLI::add_command( 'twc', 'TWC_CLI' ); | |
} | |
add_action( 'cli_init', 'twc_cli_register_commands' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment