Documentation / Administrator Guide / WP-CLI / Publish Command

WP-CLI Publish Command

This WP-CLI command allows you to start a publication from the command-line.

Note: WP-CLI is a command-line interface for WordPress that makes many tasks easier. See wp-cli.org for more information.

Syntax

The basic command to start a publication is as follows:

wp staatic publish
Setting up
Initializing crawler
Crawling WordPress site
Crawling...  100% [========================] 0:00 / 0:00
Finishing crawler
Post-processing
Initializing deployment
Initializing indexer
Deploying WordPress site
Deploying...  100% [=======================] 0:00 / 0:00
Indexing WordPress site
Finishing deployment
Finishing indexer
Finishing
Success: Publication finished in 11 seconds!

Options

There are several options available when running the publish command, which are all optional:

  • --only-urls=<urls>: Optionally a comma-separated list of URLs to update when publishing selectively.
  • --only-paths=<paths>: Optionally a comma-separated list of filesystem paths to update when publishing selectively.
  • --[no-]merge: Whether or not to merge the publication with the currently active publication. This option is implied when using the --partial option.
  • --[no-]partial: Whether or not to create a partial build, publishing only changed posts.
  • --[no-]preview: Whether or not to create a preview build, if supported by the deployment method.
  • --[no-]deploy: Whether or not to deploy the publication using the configured deployment method.
  • --[no-]force: Whether or not to force publishing, even if another publication is already in progress.
  • --[no-]verbose: Whether or not to output logs during publication.

Examples

wp staatic publish --preview --no-partial --verbose
wp staatic publish --only-urls="/sitemap.xml" --merge
wp staatic publish --only-urls="/,/contact/,/sitemap.xml" --no-deploy