Created
November 12, 2012 22:53
-
-
Save tlovett1/4062607 to your computer and use it in GitHub Desktop.
WP-CLI command in plugin
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: PMC Tag Scrubber | |
Plugin URI: http://www.pmc.com | |
Description: Download a .csv of tags/categories with their respective post counts. Flags duplicates automatically. | |
Author: Taylor Lovett, PMC, 10up | |
Version: 1.5 | |
Author URI: http://www.10up.com | |
*/ | |
if ( defined('WP_CLI') && WP_CLI ) { | |
class Example_Command extends WP_CLI_Command { | |
/** | |
* Example subcommand | |
* | |
* @param array $args | |
*/ | |
function hello( $args = array() ) { | |
// Print a success message | |
WP_CLI::success( 'Hello world!' ); | |
} | |
static function help() { | |
WP_CLI::line( 'usage: wp example hello' ); | |
} | |
} | |
// Register the class as the 'example' command handler | |
WP_CLI::add_command( 'example', 'Example_Command' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment