Created
February 17, 2024 06:48
-
-
Save deshabhishek007/48404448c460b760c806c63bbc36a469 to your computer and use it in GitHub Desktop.
WCPune 2024 Custom CLI code
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: My CLI Commands | |
Plugin URI: # | |
Description: | |
Author: WC Pune Team | |
Version: 1.0.0 | |
Author URI: https://pune.wordcamp.org | |
*/ | |
class mycommand { | |
public function world( $args, $assoc_args ) { | |
list( $name ) = $args; | |
$type = $assoc_args['type']; | |
WP_CLI::$type( "Hello $name" ); | |
} | |
} | |
if ( defined( 'WP_CLI' ) && WP_CLI ) { | |
WP_CLI::add_command( 'say-hello', 'mycommand'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment