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', ...)

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.