Last active
November 2, 2018 14:07
-
-
Save mklasen/73d25b879a9ea9accbbb26394fb7248f to your computer and use it in GitHub Desktop.
WP CLi Command
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: WP CLI Command Example | |
* Author: Marinus Klasen | |
* Description: WP CLI Command Example | |
*/ | |
/* | |
Command: wp cli mk example | |
*/ | |
class mk_wp_cli_cmd_example { | |
function __construct() { | |
$this->hooks(); | |
} | |
public function hooks() { | |
WP_CLI::add_command('mk example', array($this, 'mk_example_command')); | |
} | |
public function mk_example_command($args, $assoc_args) { | |
WP_CLI::success( 'Succeeded doing nothing :-).' ); | |
WP_CLI::error( 'I have nothing to do :-(.' ); | |
} | |
} | |
$mk_wp_cli_cmd_example = new mk_wp_cli_cmd_example(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment