Skip to content

CLI

Lumbermill ships with a set of WP-CLI commands under the wp instance namespace. They are provided by the instance-cli mu-plugin and are only available when WP-CLI is active.

One-time setup commands that enable an opt-in feature, scaffold a starter class, and update the relevant config file.

Terminal window
wp instance activate ajax
  • Creates app/Ajax/Action/ExampleAjaxAction.php
  • Sets enabled => true in config/ajax.php

See Advanced → AJAX for the full guide.

Terminal window
wp instance activate rest-api
  • Creates app/RestAPI/ExampleRestAPI.php
  • Sets enabled => true in config/rest-api.php

See Advanced → REST API for the full guide.


Scaffold classes and wire them up automatically.

All make commands accept a --confirm=true flag to skip the preview confirmation prompt.

Terminal window
wp instance make ajax <name>

Generates an AJAX action class in app/Ajax/Action/. The AjaxAction suffix is added automatically.

Terminal window
wp instance make ajax GetPosts
# → app/Ajax/Action/GetPostsAjaxAction.php
Terminal window
wp instance make rest-api <name>

Generates a REST API endpoint class in app/RestAPI/. The RestAPI suffix is added automatically.

Terminal window
wp instance make rest-api Cats
# → app/RestAPI/CatsRestAPI.php
Terminal window
wp instance make hook <name>
wp instance make hook <name> --register=true

Generates a hook class in app/Hook/. With --register=true (or confirming the prompt) it also adds the class to config/hooks.php.

Terminal window
wp instance make hook ThemeColours --register=true
# → app/Hook/ThemeColoursHook.php
# → added to config/hooks.php
Terminal window
wp instance make provider <name>

Generates a provider class in app/Provider/ and a matching config file in config/. Also registers the provider in functions.php via $config->addProvider().

Terminal window
wp instance make provider ThemeOptions
# → app/Provider/ThemeOptionsProvider.php
# → config/theme-options.php
# → $config->addProvider(new \App\Provider\ThemeOptionsProvider) added to functions.php
Terminal window
wp instance make classmap-post
wp instance make classmap-post --post-type=<slug>

Generates a Timber post classmap class in app/Classmap/Post/ and registers it. Prompts for a post type if --post-type is omitted.

Terminal window
wp instance make classmap-term
wp instance make classmap-term --taxonomy=<slug>

Generates a Timber term classmap class in app/Classmap/Term/ and registers it. Prompts for a taxonomy if --taxonomy is omitted.

Terminal window
wp instance make classmap-menu
wp instance make classmap-menu --menu=<slug>

Generates a Timber menu classmap class in app/Classmap/Menu/ and registers it.

Terminal window
wp instance make classmap-menu-item
wp instance make classmap-menu-item --menu=<slug>

Generates a Timber menu item classmap class in app/Classmap/MenuItem/ and registers it.

Terminal window
wp instance make util <name>

Generates a utility class in app/Util/. The Util suffix is added automatically.

Terminal window
wp instance make util String
# → app/Util/StringUtil.php
Terminal window
wp instance make template <name>

Generates a WordPress page template: a PHP controller file and a matching Twig view. Use kebab-case for the name.

Terminal window
wp instance make template my-page
# → templates/my-page.php
# → views/templates/my-page.twig

The PHP file includes the Template name: comment that WordPress uses to expose the template in the page editor. The Twig file extends layouts/base.twig and includes a content block ready to fill in.

Terminal window
wp instance make field-group

Interactive command that scaffolds an ACF field group for any content type. Prompts for:

  1. Location type — all 22 ACF location rules (Post Type, Page Template, Taxonomy, etc.)
  2. Location value — dynamic select list for supported types (post types, taxonomies, templates, page types, user roles, nav menus, options pages, etc.), or free-text input for the rest
  3. Field group name — kebab-case name for the group (e.g. content, meta)

New content type folder — creates the folder, index.php (with location rule), and the field group file. No wiring needed: acf-php/index.php autoloads every nested index.php via a glob, so the new folder is picked up automatically:

acf-php/post-types/post/
├── index.php ← location rule + register call
└── content.php ← createFieldGroup('Post - Content')->addField(...)

Existing content type folder — creates only the field group file and appends the load + register lines to the existing index.php.

Field group title is automatically prefixed with the location label, e.g. Post - Content, Front Page - Hero.

wp seed fills the site with example content, so templates can be built and reviewed against realistic data. Seeding and purging refuse to run in production.

Terminal window
wp seed auto # list targets and their fields
wp seed auto post page --count=5 # seed 5 posts and 5 pages
wp seed auto page:templates/contact.php # pages using a page template
wp seed auto post --generate-images # placeholder images instead of the media library

Fills the target’s ACF fields based on their type: text, links, images, relations, repeaters, flexible content and so on. Fields of a type it doesn’t know are left empty and listed after the run. Images are picked from the media library unless --generate-images is passed.

Each run is a batch, so it can be removed again:

Terminal window
wp seed batches # list batches
wp seed purge --batch=<batch> # remove one batch
wp seed purge # remove everything seeded

Purging deletes the posts, terms and images the seeder created, nothing else.

Some fields need a valid value rather than random content, e.g. an ID that links to another post. Filter them in a seeder file in web/app/mu-plugins/instance-seed/seeders/, which is loaded automatically:

web/app/mu-plugins/instance-seed/seeders/auto-project.php
<?php
add_filter('instance_seed/field_value', static function (mixed $value, array $field, array $context): mixed {
return match ([$context['post_type'], $field['name']]) {
['event', 'event_details_capacity'] => 120,
default => $value,
};
}, 10, 3);
add_action('instance_seed/seeded_post', static function (int $postId, string $postType): void {
// runs after each seeded post
}, 10, 2);

A custom seeder can also register its own command, e.g. wp seed news, with WP_CLI::add_command() in the same folder.