Last active
December 6, 2019 15:35
-
-
Save maheshwaghmare/b16f9a74c0f25639f0d4d89255223512 to your computer and use it in GitHub Desktop.
Hello World program of WP CLI (WordPress Command Line Interface)
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
<?php | |
/** | |
* Common API's: WP CLI | |
* | |
* 1. Run `wp examples hello_world` Simple Command. | |
* | |
* @package wordpress-examples | |
* @since 1.0.0 | |
*/ | |
if ( ! class_exists( 'WordPress_Examples_WP_CLI' ) && class_exists( 'WP_CLI_Command' ) ) : | |
/** | |
* WordPress Examples | |
*/ | |
class WordPress_Examples_WP_CLI extends WP_CLI_Command { | |
/** | |
* hello_world | |
* | |
* ## EXAMPLES | |
* | |
* # Simple Command | |
* $ wp examples hello_world | |
* ok | |
* | |
* @since 1.0.0 | |
* @param array $args Arguments. | |
* @param array $assoc_args Associated Arguments. | |
* | |
* @alias list | |
*/ | |
public function hello_world( $args, $assoc_args ) { | |
// Code Goes Here.. | |
} | |
} | |
/** | |
* Add Command | |
*/ | |
WP_CLI::add_command( 'examples', 'WordPress_Examples_WP_CLI' ); | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment