Skip to content

Instantly share code, notes, and snippets.

@mklasen
Last active November 2, 2018 14:07
Show Gist options
  • Save mklasen/73d25b879a9ea9accbbb26394fb7248f to your computer and use it in GitHub Desktop.
Save mklasen/73d25b879a9ea9accbbb26394fb7248f to your computer and use it in GitHub Desktop.
WP CLi Command
<?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