Skip to content

Instantly share code, notes, and snippets.

@tlovett1
Created November 12, 2012 22:53
Show Gist options
  • Save tlovett1/4062607 to your computer and use it in GitHub Desktop.
Save tlovett1/4062607 to your computer and use it in GitHub Desktop.
WP-CLI command in plugin
<?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