Skip to content

WP-CLI#

wp bb-snippets list [--active] [--format=table|csv|json|ids]
wp bb-snippets get <id|key> [--code]
wp bb-snippets create <title> [--file=<path>] [--language=css|js|html] [--where=header|footer|body_open|shortcode]
    [--linking=internal|external|both|desktop|mobile] [--side=frontend,admin,login,block] [--priority=1-10] [--minify]
    [--rule=<type:value> | --rules=<json>] [--key=<key>] [--env=<list>] [--inactive] [--status=publish|draft]
wp bb-snippets update <id|key> [--file=<path>] [--title=<title>] [the same flags] [--expires=YYYY-MM-DD|none]
    [--owner=<name>] [--notes=<text>] [--env=all]
wp bb-snippets activate <id|key>
wp bb-snippets deactivate <id|key>
wp bb-snippets test-url <path-or-url> [--format=table|json]
wp bb-snippets doctor [--clean [--yes]]
wp bb-snippets rebuild
wp bb-snippets export [<id|key>...] [--file=<path>]
wp bb-snippets import <file> [--dry-run]
wp bb-snippets files [--format=table|csv|json]
wp bb-snippets to-file <id|key> [--dir=<path>] [--stdout] [--force]

create and update also take --preprocessor=none|sass|less, --partial=<_name.scss|none> (import-only partial) and --critical=auto|inline|defer (linked files; inline is CSS only).

list includes theme file snippets (source file:…); files lists only those, with their warnings. to-file writes a database snippet into the active theme's snippets/ folder; the file prints once the database snippet is trashed.

Code is read from --file or standard input. Rules: --rule="contains:/pricing/", --rule=all, --rule="wp-conditional:is_singular('post')", or the whole list as JSON in --rules. A conditional that will never match is reported when it is saved.

doctor reports a stale manifest (and rebuilds it), missing files, every warning, and unused files; --clean deletes the unused files after asking.