Skip to content

Instantly share code, notes, and snippets.

@maheshwaghmare
Last active December 6, 2019 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maheshwaghmare/b16f9a74c0f25639f0d4d89255223512 to your computer and use it in GitHub Desktop.
Save maheshwaghmare/b16f9a74c0f25639f0d4d89255223512 to your computer and use it in GitHub Desktop.
Hello World program of WP CLI (WordPress Command Line Interface)
<?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