Skip to content

About

A modular WP-CLI package for BuiltNorth WordPress development workflows.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Built North WP-CLI Commands

A modular WP-CLI package for BuiltNorth WordPress development workflows.

Installation

wp package install builtnorth/wp-cli-builtnorth

Commands

Setup (Standard)

Standard WordPress project setup:

wp builtnorth setup --name="My Project" --email="admin@example.com" --password="secure123"

This command provides:

  • WordPress installation with database management
  • Theme handling - Installs from composer, setup/data/themes, or default WordPress themes
  • Plugin activation - Activates all available plugins
  • Content import - Imports from setup/data/content/*.xml
  • Media import - Imports with automatic logo/icon detection
  • Settings configuration - Timezone, permalinks, upload settings
  • Page setup - Configures home and blog pages if found

Options:

  • --name=<name> - Project name (required)
  • --username=<username> - WordPress admin username (default: admin)
  • --password=<password> - WordPress admin password (required)
  • --email=<email> - WordPress admin email (required)

Setup BN Project

BuiltNorth-specific project setup with Compass theme:

wp builtnorth setup-bn-project --name="My Project" --email="admin@example.com" --password="secure123"

This enhanced setup includes everything from standard setup plus:

  • Compass theme conversion - Automatically converts the Compass theme to a project-specific theme
  • Theme customization - Renames theme to match project name, removes git references
  • Dependency management - Removes compass from composer.json after conversion
  • NPM workspace integration - Adds the new theme to npm workspaces and updates build scripts
  • Advanced configuration - Additional BuiltNorth-specific optimizations

Options:

  • --name=<name> - Project name (required)
  • --username=<username> - WordPress admin username (default: admin)
  • --password=<password> - WordPress admin password (required)
  • --email=<email> - WordPress admin email (required)
  • --skip-wordpress - Skip WordPress installation
  • --yes - Skip confirmation prompts

Configure

Configure WordPress after installation:

wp builtnorth configure

Options:

  • --skip-content - Skip content import
  • --skip-media - Skip media import
  • --site-url=<url> - Replace the site's current URL with this one (search-replace)
  • --yes - Skip confirmation prompts

Post Type Switch

Convert posts from one post type to another:

# Basic conversion
wp builtnorth post-type-switch --from=post --to=article

# Preview changes without making them
wp builtnorth post-type-switch --from=post --to=news --dry-run

# Convert only published posts
wp builtnorth post-type-switch --from=post --to=resource --status=publish

# Convert with taxonomy handling
wp builtnorth post-type-switch --from=post --to=portfolio --include-taxonomies

Features:

  • Safe conversion with validation and confirmation prompts
  • Dry run mode to preview changes
  • Taxonomy handling - preserves shared taxonomies, removes unsupported ones
  • Status filtering - convert only posts with specific status
  • Batch limiting - test with a limited number of posts first
  • Automatic cleanup - flushes rewrite rules and clears caches

Options:

  • --from=<post-type> - Source post type (required)
  • --to=<post-type> - Target post type (required)
  • --status=<status> - Only convert posts with this status (default: any)
  • --limit=<number> - Limit number of posts to convert
  • --dry-run - Preview changes without making them
  • --include-taxonomies - Handle taxonomy mappings between post types
  • --yes - Skip confirmation prompt

Generate

Generate test content for development:

wp builtnorth generate --count=20 --post-type=post

Options:

  • --count=<count> - Number of posts to generate (default: 10)
  • --post-type=<post-type> - Post type to generate (default: post)
  • --taxonomy=<taxonomy> - Taxonomy to assign terms from
  • --terms=<terms> - Comma-separated list of term slugs to create/assign
  • --random-terms - Randomly assign terms to posts
  • --with-content - Generate content for posts

Adding New Commands

  1. Create a new command class in inc/classes/Commands/ extending BaseCommand
  2. Register it in command.php
  3. Use traits from inc/classes/Traits/ for common functionality

Example:

namespace BuiltNorth\CLI\Commands;

use BuiltNorth\CLI\BaseCommand;

class ExportCommand extends BaseCommand {
    protected $command_name = 'export';
    
    protected function get_shortdesc() {
        return 'Export site data';
    }
    
    public function __invoke($args, $assoc_args) {
        // Implementation
    }
}

Architecture

  • BaseCommand - Common functionality for all commands
  • Traits - Reusable functionality (FileOperations, etc.)
  • Utils - Helper classes
  • Commands - Individual command implementations

This modular structure allows easy addition of new commands like import/export, migration tools, and more.

License

GPL-3.0-or-later — see LICENSE.

Disclaimer

This software is provided "as is", without warranty of any kind, express or implied, including the warranties of merchantability and fitness for a particular purpose. To the extent permitted by applicable law, the authors and copyright holders, together with their parent, subsidiary, and affiliated companies and contributors, are not liable for any direct, indirect, incidental, or consequential damages arising from its use or inability to use it, including loss of data, revenue, or site availability.

The software does not guarantee that your site is secure, ranks in search results, or complies with privacy or other laws; that remains the site owner's responsibility. AI-generated content can be inaccurate and should be reviewed before publishing. Third-party services the software connects to are governed by their own terms.

Keep a current backup and test changes on a staging site before applying them to a live site. See sections 15 and 16 of the GNU General Public License, version 3, for the full terms.

About

A modular WP-CLI package for BuiltNorth WordPress development workflows.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages