├── .github
├── CODEOWNERS
└── workflows
│ └── code-quality.yml
├── .gitignore
├── LICENSE
├── README.md
├── behat-steps.md
├── behat-steps
├── given-a-custom-wp-content-directory.md
├── given-a-database.md
├── given-a-dependency-on-current-wp-cli.md
├── given-a-downloaded-phar-with-the-same-version-version.md
├── given-a-misconfigured-wp-content-dir-constant-directory.md
├── given-a-new-phar-with-the-same-version-version.md
├── given-a-php-built-in-web-server-to-serve-subdir.md
├── given-a-php-built-in-web-server.md
├── given-a-wp-installation-in-subdir.md
├── given-a-wp-installation-with-composer-and-a-custom-vendor-directory-vendor-directory.md
├── given-a-wp-installation-with-composer.md
├── given-a-wp-installation.md
├── given-a-wp-multisite-subdirectory-subdomaininstall-installation.md
├── given-an-empty-cache.md
├── given-an-empty-directory.md
├── given-an-empty-non-existent-directory.md
├── given-an-file-cache-file.md
├── given-download.md
├── given-replaced-with-in-the-file.md
├── given-save-stdout-stderr-as.md
├── given-save-the-file-as.md
├── given-that-http-requests-to-will-respond-with.md
├── given-these-installed-and-active-plugins.md
├── given-wp-config-php.md
├── given-wp-files.md
├── then-an-email-should-be-sent-not-be-sent.md
├── then-stdout-should-be-a-json-array-containing.md
├── then-stdout-should-be-a-table-containing-rows.md
├── then-stdout-should-be-csv-containing.md
├── then-stdout-should-be-json-containing.md
├── then-stdout-should-be-yaml-containing.md
├── then-stdout-should-end-with-a-table-containing-rows.md
├── then-stdout-stderr-should-be-a-number.md
├── then-stdout-stderr-should-be-a-version-string-w.md
├── then-stdout-stderr-should-be-empty.md
├── then-stdout-stderr-should-not-be-a-number.md
├── then-stdout-stderr-should-not-be-empty.md
├── then-stdout-stderr-should-not-match.md
├── then-stdout-stderr-should-strictly-be-contain-not-contain.md
├── then-the-contents-of-the-file-should-not-match.md
├── then-the-file-directory-should-strictly-exist-not-exist-be-contain-not-contain.md
├── then-the-http-status-code-should-be-code.md
├── then-the-return-code-should-not-be.md
├── when-i-launch-in-the-background.md
├── when-i-run-try-from.md
├── when-i-run-try-the-previous-command-again.md
└── when-i-run-try.md
├── bin
├── command.php
├── commands-manifest.json
├── handbook-manifest.json
├── install_packages.sh
└── templates
│ ├── behat-steps-list.mustache
│ ├── behat-steps.mustache
│ ├── internal-api-list.mustache
│ ├── internal-api.mustache
│ └── subcmd-list.mustache
├── bug-reports.md
├── code-review.md
├── commands-cookbook.md
├── commands
├── admin.md
├── cache.md
├── cache
│ ├── add.md
│ ├── decr.md
│ ├── delete.md
│ ├── flush-group.md
│ ├── flush.md
│ ├── get.md
│ ├── incr.md
│ ├── patch.md
│ ├── pluck.md
│ ├── replace.md
│ ├── set.md
│ ├── supports.md
│ └── type.md
├── cap.md
├── cap
│ ├── add.md
│ ├── list.md
│ └── remove.md
├── cli.md
├── cli
│ ├── alias.md
│ ├── alias
│ │ ├── add.md
│ │ ├── delete.md
│ │ ├── get.md
│ │ ├── is-group.md
│ │ ├── list.md
│ │ └── update.md
│ ├── cache.md
│ ├── cache
│ │ ├── clear.md
│ │ └── prune.md
│ ├── check-update.md
│ ├── cmd-dump.md
│ ├── completions.md
│ ├── has-command.md
│ ├── info.md
│ ├── param-dump.md
│ ├── update.md
│ └── version.md
├── comment.md
├── comment
│ ├── approve.md
│ ├── count.md
│ ├── create.md
│ ├── delete.md
│ ├── exists.md
│ ├── generate.md
│ ├── get.md
│ ├── list.md
│ ├── meta.md
│ ├── meta
│ │ ├── add.md
│ │ ├── delete.md
│ │ ├── get.md
│ │ ├── list.md
│ │ ├── patch.md
│ │ ├── pluck.md
│ │ └── update.md
│ ├── recount.md
│ ├── spam.md
│ ├── status.md
│ ├── trash.md
│ ├── unapprove.md
│ ├── unspam.md
│ ├── untrash.md
│ └── update.md
├── config.md
├── config
│ ├── create.md
│ ├── delete.md
│ ├── edit.md
│ ├── get.md
│ ├── has.md
│ ├── is-true.md
│ ├── list.md
│ ├── path.md
│ ├── set.md
│ └── shuffle-salts.md
├── core.md
├── core
│ ├── check-update.md
│ ├── download.md
│ ├── install.md
│ ├── is-installed.md
│ ├── multisite-convert.md
│ ├── multisite-install.md
│ ├── update-db.md
│ ├── update.md
│ ├── verify-checksums.md
│ └── version.md
├── cron.md
├── cron
│ ├── event.md
│ ├── event
│ │ ├── delete.md
│ │ ├── list.md
│ │ ├── run.md
│ │ ├── schedule.md
│ │ └── unschedule.md
│ ├── schedule.md
│ ├── schedule
│ │ └── list.md
│ └── test.md
├── db.md
├── db
│ ├── check.md
│ ├── clean.md
│ ├── cli.md
│ ├── columns.md
│ ├── create.md
│ ├── drop.md
│ ├── export.md
│ ├── import.md
│ ├── optimize.md
│ ├── prefix.md
│ ├── query.md
│ ├── repair.md
│ ├── reset.md
│ ├── search.md
│ ├── size.md
│ └── tables.md
├── dist-archive.md
├── embed.md
├── embed
│ ├── cache.md
│ ├── cache
│ │ ├── clear.md
│ │ ├── find.md
│ │ └── trigger.md
│ ├── fetch.md
│ ├── handler.md
│ ├── handler
│ │ └── list.md
│ ├── provider.md
│ └── provider
│ │ ├── list.md
│ │ └── match.md
├── eval-file.md
├── eval.md
├── export.md
├── find.md
├── help.md
├── i18n.md
├── i18n
│ ├── make-json.md
│ ├── make-mo.md
│ ├── make-php.md
│ ├── make-pot.md
│ └── update-po.md
├── import.md
├── language.md
├── language
│ ├── core.md
│ ├── core
│ │ ├── activate.md
│ │ ├── install.md
│ │ ├── is-installed.md
│ │ ├── list.md
│ │ ├── uninstall.md
│ │ └── update.md
│ ├── plugin.md
│ ├── plugin
│ │ ├── install.md
│ │ ├── is-installed.md
│ │ ├── list.md
│ │ ├── uninstall.md
│ │ └── update.md
│ ├── theme.md
│ └── theme
│ │ ├── install.md
│ │ ├── is-installed.md
│ │ ├── list.md
│ │ ├── uninstall.md
│ │ └── update.md
├── maintenance-mode.md
├── maintenance-mode
│ ├── activate.md
│ ├── deactivate.md
│ ├── is-active.md
│ └── status.md
├── media.md
├── media
│ ├── fix-orientation.md
│ ├── image-size.md
│ ├── import.md
│ └── regenerate.md
├── menu.md
├── menu
│ ├── create.md
│ ├── delete.md
│ ├── item.md
│ ├── item
│ │ ├── add-custom.md
│ │ ├── add-post.md
│ │ ├── add-term.md
│ │ ├── delete.md
│ │ ├── list.md
│ │ └── update.md
│ ├── list.md
│ ├── location.md
│ └── location
│ │ ├── assign.md
│ │ ├── list.md
│ │ └── remove.md
├── network.md
├── network
│ ├── meta.md
│ └── meta
│ │ ├── add.md
│ │ ├── delete.md
│ │ ├── get.md
│ │ ├── list.md
│ │ ├── patch.md
│ │ ├── pluck.md
│ │ └── update.md
├── option.md
├── option
│ ├── add.md
│ ├── delete.md
│ ├── get-autoload.md
│ ├── get.md
│ ├── list.md
│ ├── patch.md
│ ├── pluck.md
│ ├── set-autoload.md
│ └── update.md
├── package.md
├── package
│ ├── browse.md
│ ├── install.md
│ ├── list.md
│ ├── path.md
│ ├── uninstall.md
│ └── update.md
├── plugin.md
├── plugin
│ ├── activate.md
│ ├── auto-updates.md
│ ├── auto-updates
│ │ ├── disable.md
│ │ ├── enable.md
│ │ └── status.md
│ ├── deactivate.md
│ ├── delete.md
│ ├── get.md
│ ├── install.md
│ ├── is-active.md
│ ├── is-installed.md
│ ├── list.md
│ ├── path.md
│ ├── search.md
│ ├── status.md
│ ├── toggle.md
│ ├── uninstall.md
│ ├── update.md
│ └── verify-checksums.md
├── post-type.md
├── post-type
│ ├── get.md
│ └── list.md
├── post.md
├── post
│ ├── create.md
│ ├── delete.md
│ ├── edit.md
│ ├── exists.md
│ ├── generate.md
│ ├── get.md
│ ├── list.md
│ ├── meta.md
│ ├── meta
│ │ ├── add.md
│ │ ├── clean-duplicates.md
│ │ ├── delete.md
│ │ ├── get.md
│ │ ├── list.md
│ │ ├── patch.md
│ │ ├── pluck.md
│ │ └── update.md
│ ├── term.md
│ ├── term
│ │ ├── add.md
│ │ ├── list.md
│ │ ├── remove.md
│ │ └── set.md
│ ├── update.md
│ └── url-to-id.md
├── profile.md
├── profile
│ ├── eval-file.md
│ ├── eval.md
│ ├── hook.md
│ └── stage.md
├── rewrite.md
├── rewrite
│ ├── flush.md
│ ├── list.md
│ └── structure.md
├── role.md
├── role
│ ├── create.md
│ ├── delete.md
│ ├── exists.md
│ ├── list.md
│ └── reset.md
├── scaffold.md
├── scaffold
│ ├── block.md
│ ├── child-theme.md
│ ├── plugin-tests.md
│ ├── plugin.md
│ ├── post-type.md
│ ├── taxonomy.md
│ ├── theme-tests.md
│ └── underscores.md
├── search-replace.md
├── server.md
├── shell.md
├── sidebar.md
├── sidebar
│ └── list.md
├── site.md
├── site
│ ├── activate.md
│ ├── archive.md
│ ├── create.md
│ ├── deactivate.md
│ ├── delete.md
│ ├── empty.md
│ ├── generate.md
│ ├── list.md
│ ├── mature.md
│ ├── meta.md
│ ├── meta
│ │ ├── add.md
│ │ ├── delete.md
│ │ ├── get.md
│ │ ├── list.md
│ │ ├── patch.md
│ │ ├── pluck.md
│ │ └── update.md
│ ├── option.md
│ ├── option
│ │ ├── add.md
│ │ ├── delete.md
│ │ ├── get.md
│ │ ├── list.md
│ │ ├── patch.md
│ │ ├── pluck.md
│ │ └── update.md
│ ├── private.md
│ ├── public.md
│ ├── spam.md
│ ├── switch-language.md
│ ├── unarchive.md
│ ├── unmature.md
│ └── unspam.md
├── super-admin.md
├── super-admin
│ ├── add.md
│ ├── list.md
│ └── remove.md
├── taxonomy.md
├── taxonomy
│ ├── get.md
│ └── list.md
├── term.md
├── term
│ ├── create.md
│ ├── delete.md
│ ├── generate.md
│ ├── get.md
│ ├── list.md
│ ├── meta.md
│ ├── meta
│ │ ├── add.md
│ │ ├── delete.md
│ │ ├── get.md
│ │ ├── list.md
│ │ ├── patch.md
│ │ ├── pluck.md
│ │ └── update.md
│ ├── migrate.md
│ ├── recount.md
│ └── update.md
├── theme.md
├── theme
│ ├── activate.md
│ ├── auto-updates.md
│ ├── auto-updates
│ │ ├── disable.md
│ │ ├── enable.md
│ │ └── status.md
│ ├── delete.md
│ ├── disable.md
│ ├── enable.md
│ ├── get.md
│ ├── install.md
│ ├── is-active.md
│ ├── is-installed.md
│ ├── list.md
│ ├── mod.md
│ ├── mod
│ │ ├── get.md
│ │ ├── list.md
│ │ ├── remove.md
│ │ └── set.md
│ ├── path.md
│ ├── search.md
│ ├── status.md
│ └── update.md
├── transient.md
├── transient
│ ├── delete.md
│ ├── get.md
│ ├── list.md
│ ├── patch.md
│ ├── pluck.md
│ ├── set.md
│ └── type.md
├── user.md
├── user
│ ├── add-cap.md
│ ├── add-role.md
│ ├── application-password.md
│ ├── application-password
│ │ ├── create.md
│ │ ├── delete.md
│ │ ├── exists.md
│ │ ├── get.md
│ │ ├── list.md
│ │ ├── record-usage.md
│ │ └── update.md
│ ├── check-password.md
│ ├── create.md
│ ├── delete.md
│ ├── exists.md
│ ├── generate.md
│ ├── get.md
│ ├── import-csv.md
│ ├── list-caps.md
│ ├── list.md
│ ├── meta.md
│ ├── meta
│ │ ├── add.md
│ │ ├── delete.md
│ │ ├── get.md
│ │ ├── list.md
│ │ ├── patch.md
│ │ ├── pluck.md
│ │ └── update.md
│ ├── remove-cap.md
│ ├── remove-role.md
│ ├── reset-password.md
│ ├── session.md
│ ├── session
│ │ ├── destroy.md
│ │ └── list.md
│ ├── set-role.md
│ ├── signup.md
│ ├── signup
│ │ ├── activate.md
│ │ ├── delete.md
│ │ ├── get.md
│ │ └── list.md
│ ├── spam.md
│ ├── term.md
│ ├── term
│ │ ├── add.md
│ │ ├── list.md
│ │ ├── remove.md
│ │ └── set.md
│ ├── unspam.md
│ └── update.md
├── widget.md
└── widget
│ ├── add.md
│ ├── deactivate.md
│ ├── delete.md
│ ├── list.md
│ ├── move.md
│ ├── reset.md
│ └── update.md
├── committers-credo.md
├── common-issues.md
├── composer.json
├── config.md
├── contributing.md
├── contributor-day.md
├── doctor-check-constant-value.md
├── doctor-check-file-contents.md
├── doctor-check-option-value.md
├── doctor-check-plugin-status.md
├── doctor-customize-config.md
├── doctor-default-checks.md
├── doctor-write-custom-check.md
├── doctor.md
├── documentation-standards.md
├── external-resources.md
├── force-output-specific-locale.md
├── governance.md
├── hack-day.md
├── hosting-companies.md
├── how-to-create-custom-plugins.md
├── how-to-install.md
├── how-to-maintenance-mode.md
├── how-to-start-webserver.md
├── how-to.md
├── identify-plugin-theme-conflict.md
├── implementation-details.md
├── index.md
├── installing.md
├── internal-api.md
├── internal-api
├── wp-cli-add-command.md
├── wp-cli-add-hook.md
├── wp-cli-add-wp-hook.md
├── wp-cli-colorize.md
├── wp-cli-confirm.md
├── wp-cli-debug.md
├── wp-cli-do-hook.md
├── wp-cli-error-multi-line.md
├── wp-cli-error.md
├── wp-cli-get-config.md
├── wp-cli-get-php-binary.md
├── wp-cli-halt.md
├── wp-cli-has-config.md
├── wp-cli-launch-self.md
├── wp-cli-launch.md
├── wp-cli-line.md
├── wp-cli-log.md
├── wp-cli-read-value.md
├── wp-cli-run-command.md
├── wp-cli-runcommand.md
├── wp-cli-success.md
├── wp-cli-utils-basename.md
├── wp-cli-utils-esc-like.md
├── wp-cli-utils-format-items.md
├── wp-cli-utils-get-flag-value.md
├── wp-cli-utils-get-home-dir.md
├── wp-cli-utils-get-named-sem-ver.md
├── wp-cli-utils-get-php-binary.md
├── wp-cli-utils-get-temp-dir.md
├── wp-cli-utils-http-request.md
├── wp-cli-utils-ispiped.md
├── wp-cli-utils-launch-editor-for-input.md
├── wp-cli-utils-make-progress-bar.md
├── wp-cli-utils-normalize-path.md
├── wp-cli-utils-parse-ssh-url.md
├── wp-cli-utils-parse-str-to-argv.md
├── wp-cli-utils-proc-open-compat.md
├── wp-cli-utils-report-batch-operation-results.md
├── wp-cli-utils-trailingslashit.md
├── wp-cli-utils-write-csv.md
└── wp-cli-warning.md
├── philosophy.md
├── phpcs.xml.dist
├── plugin-unit-tests.md
├── pull-requests.md
├── quick-start.md
├── release-checklist.md
├── repository-management.md
├── roadmap.md
├── running-commands-remotely.md
├── sharing-wp-cli-packages.md
├── shell-friends.md
├── tools.md
├── troubleshooting.md
└── wp-cli.yml
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @wp-cli/committers
2 |
--------------------------------------------------------------------------------
/.github/workflows/code-quality.yml:
--------------------------------------------------------------------------------
1 | name: Code Quality Checks
2 |
3 | on:
4 | pull_request:
5 | push:
6 | branches:
7 | - main
8 | - master
9 |
10 | jobs:
11 | code-quality:
12 | uses: wp-cli/.github/.github/workflows/reusable-code-quality.yml@main
13 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | _site
2 | .DS_Store
3 | Gemfile.lock
4 | composer.lock
5 | vendor
6 | _drafts/
7 | bin/packages
8 | .*.swp
9 | commands/doctor*
10 | commands/google-sitemap*
11 | commands/maintenance*
12 | commands/super-cache*
13 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (C) 2012-2022 WP-CLI Development Group (https://github.com/wp-cli/handbook/contributors)
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | wp-cli/handbook
2 | ===============
3 |
4 | These files comprise the WP-CLI handbook ([make.wordpress.org/cli/handbook](https://make.wordpress.org/cli/handbook/)) and WP-CLI commands directory ([developer.wordpress.org/cli/commands](https://developer.wordpress.org/cli/commands/)).
5 |
6 | The documentation is located in GitHub to enable a pull request-based editing workflow.
7 |
8 | Long-form documentation (e.g. "Commands cookbook") can be edited directly.
9 |
10 | Internal API docs and command pages are generated dynamically from the WP-CLI codebase using the `wp handbook` series of commands.
11 |
12 | Before running these commands the bash script `bin/install-packages.sh` should be run to install the latest versions of the non-bundled commands in `bin/packages`. Note `wp` must point to the target WP-CLI instance, i.e. the phar/git that contains the docblocks to be generated against, and should be run with `WP_CLI_PACKAGES_DIR=bin/packages` and `WP_CLI_CONFIG_PATH=/dev/null`.
13 |
14 | So for instance to generate all dynamically created documentation against the nightly phar run:
15 |
16 | ```
17 | wp cli update --nightly
18 | bin/install_packages.sh
19 | WP_CLI_PACKAGES_DIR=bin/packages WP_CLI_CONFIG_PATH=/dev/null wp handbook gen-all
20 | ```
21 |
22 | All documentation is imported automatically into WordPress.org in a two step process:
23 |
24 | 1. WordPress reads `commands-manifest.json` or `handbook-manifest.json` to understand all pages that need to be created.
25 | 2. Each WordPress page has a `markdown_source` attribute specifying a Markdown file to be fetched, converted to HTML, and saved in the database.
26 |
27 | For make.wordpress.org/cli, the import process is a [WordPress plugin](https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-cli/inc/class-markdown-import.php) running a WP Cron job every 15 minutes. For developer.wordpress.org/cli, this is a [class in the devhub theme](https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/cli.php) running a WP Cron job every 12 hours.
28 |
--------------------------------------------------------------------------------
/behat-steps/when-i-launch-in-the-background.md:
--------------------------------------------------------------------------------
1 | # When /^I launch in the background `([^`]+)`$/
2 |
3 | Launch a given command in the background.
4 |
5 |
6 | ***
7 |
8 | ## Usage
9 |
10 | ```
11 | Scenario: My example scenario
12 | Given a WP install
13 | And I launch in the background `wp server --host=localhost --port=8181`
14 | ...
15 | ```
16 |
17 |
18 | *Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.*
19 |
20 |
21 | ***
22 |
23 | ## Related
24 |
25 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/behat-steps/when-i-run-try-from.md:
--------------------------------------------------------------------------------
1 | # When /^I (run|try) `([^`]+)` from '([^\s]+)'$/
2 |
3 | Run or try a given command in a subdirectory.
4 |
5 |
6 | ***
7 |
8 | ## Usage
9 |
10 | `run` expects an exit code 0, whereas `try` allows for non-zero exit codes.
11 |
12 | ```
13 | Scenario: My example scenario
14 | When I run `wp core is-installed`
15 | Then STDOUT should be empty
16 |
17 | When I run `wp core is-installed` from 'foo/wp-content'
18 | Then STDOUT should be empty
19 | ```
20 |
21 |
22 | *Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.*
23 |
24 |
25 | ***
26 |
27 | ## Related
28 |
29 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/behat-steps/when-i-run-try-the-previous-command-again.md:
--------------------------------------------------------------------------------
1 | # When /^I (run|try) the previous command again$/
2 |
3 | Run or try the previous command again.
4 |
5 |
6 | ***
7 |
8 | ## Usage
9 |
10 | `run` expects an exit code 0, whereas `try` allows for non-zero exit codes.
11 |
12 | ```
13 | Scenario: My example scenario
14 | When I run `wp site option update admin_user_id 1`
15 | Then STDOUT should contain:
16 | """
17 | Success: Updated 'admin_user_id' site option.
18 | """
19 |
20 | When I run the previous command again
21 | Then STDOUT should contain:
22 | """
23 | Success: Value passed for 'admin_user_id' site option is unchanged.
24 | """
25 | ```
26 |
27 |
28 | *Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.*
29 |
30 |
31 | ***
32 |
33 | ## Related
34 |
35 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/behat-steps/when-i-run-try.md:
--------------------------------------------------------------------------------
1 | # When /^I (run|try) `([^`]+)`$/
2 |
3 | Run or try a given command.
4 |
5 |
6 | ***
7 |
8 | ## Usage
9 |
10 | `run` expects an exit code 0, whereas `try` allows for non-zero exit codes.
11 |
12 | So if using `run` and the command errors, the step will fail.
13 |
14 | ```
15 | Scenario: My example scenario
16 | When I run `wp core version`
17 | Then STDOUT should contain:
18 | """
19 | 6.8
20 | """
21 |
22 | Scenario: My other scenario
23 | When I try `wp i18n make-pot foo bar/baz.pot`
24 | Then STDERR should contain:
25 | """
26 | Error: Not a valid source directory.
27 | """
28 | And the return code should be 1
29 | ```
30 |
31 |
32 | *Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.*
33 |
34 |
35 | ***
36 |
37 | ## Related
38 |
39 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/bin/install_packages.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Installs the 4 non-bundled packages in `bin/packages`. To be run before using the `wp handbook` commands.
4 |
5 | WP_CLI_PACKAGES_DIR=bin/packages WP_CLI_CONFIG_PATH=/dev/null wp package install wp-cli/admin-command
6 | WP_CLI_PACKAGES_DIR=bin/packages WP_CLI_CONFIG_PATH=/dev/null wp package install wp-cli/find-command
7 | WP_CLI_PACKAGES_DIR=bin/packages WP_CLI_CONFIG_PATH=/dev/null wp package install wp-cli/profile-command
8 | WP_CLI_PACKAGES_DIR=bin/packages WP_CLI_CONFIG_PATH=/dev/null wp package install wp-cli/dist-archive-command
9 |
--------------------------------------------------------------------------------
/bin/templates/behat-steps-list.mustache:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{#apis}}
4 |
5 | - {{full_name}} - {{phpdoc.short_description}}
6 |
7 | {{/apis}}
8 |
9 |
10 |
--------------------------------------------------------------------------------
/bin/templates/behat-steps.mustache:
--------------------------------------------------------------------------------
1 | # {{full_name}}
2 |
3 | {{phpdoc.short_description}}
4 |
5 | {{#phpdoc.long_description}}
6 |
7 | ***
8 |
9 | ## Usage
10 |
11 | {{{phpdoc.long_description}}}
12 |
13 | {{/phpdoc.long_description}}
14 |
15 | *Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.*
16 |
17 | {{#has_related}}
18 |
19 | ***
20 |
21 | ## Related
22 |
23 |
24 |
25 | {{/has_related}}
26 |
27 | {{#related}}
28 |
29 | - {{full_name}} - {{phpdoc.short_description}}
30 |
31 | {{/related}}
32 |
33 | {{#has_related}}
34 |
35 |
36 |
37 | {{/has_related}}
38 |
39 |
--------------------------------------------------------------------------------
/bin/templates/internal-api-list.mustache:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{#apis}}
4 |
5 | - {{full_name}}() - {{phpdoc.short_description}}
6 |
7 | {{/apis}}
8 |
9 |
10 |
--------------------------------------------------------------------------------
/bin/templates/internal-api.mustache:
--------------------------------------------------------------------------------
1 | # {{full_name}}()
2 |
3 | {{phpdoc.short_description}}
4 |
5 | ***
6 |
7 | ## Usage
8 |
9 | {{signature}}
10 |
11 |
12 | {{#phpdoc.parameters.param}}
13 | {{1}} ({{0}}) {{{2}}}
14 | {{/phpdoc.parameters.param}}
15 | {{#phpdoc.parameters.return}}
16 | @return ({{0}}) {{2}}
17 | {{/phpdoc.parameters.return}}
18 |
19 |
20 | {{#phpdoc.long_description}}
21 |
22 | ***
23 |
24 | ## Notes
25 |
26 | {{{phpdoc.long_description}}}
27 |
28 | {{/phpdoc.long_description}}
29 |
30 | *Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.*
31 |
32 | {{#has_related}}
33 |
34 | ***
35 |
36 | ## Related
37 |
38 |
39 |
40 | {{/has_related}}
41 |
42 | {{#related}}
43 |
44 | - {{full_name}}() - {{phpdoc.short_description}}
45 |
46 | {{/related}}
47 |
48 | {{#has_related}}
49 |
50 |
51 |
52 | {{/has_related}}
53 |
54 |
--------------------------------------------------------------------------------
/bin/templates/subcmd-list.mustache:
--------------------------------------------------------------------------------
1 | # wp {{synopsis}}
2 |
3 | {{description}}
4 |
5 | {{{docs}}}
6 |
--------------------------------------------------------------------------------
/commands/admin.md:
--------------------------------------------------------------------------------
1 | # wp admin
2 |
3 | Open /wp-admin/ in a browser.
4 |
5 |
6 |
7 | ### GLOBAL PARAMETERS
8 |
9 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
10 |
11 | | **Argument** | **Description** |
12 | |:----------------|:-----------------------------|
13 | | `--path=` | Path to the WordPress files. |
14 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
15 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
16 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
17 | | `--user=` | Set the WordPress user. |
18 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
19 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
20 | | `--skip-packages` | Skip loading all installed packages. |
21 | | `--require=` | Load PHP file before running the command (may be used more than once). |
22 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
23 | | `--context=` | Load WordPress in a given context. |
24 | | `--[no-]color` | Whether to colorize the output. |
25 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
26 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
27 | | `--quiet` | Suppress informational messages. |
28 |
--------------------------------------------------------------------------------
/commands/cache.md:
--------------------------------------------------------------------------------
1 | # wp cache
2 |
3 | Adds, removes, fetches, and flushes the WP Object Cache object.
4 |
5 | By default, the WP Object Cache exists in PHP memory for the length of the request (and is emptied at the end). Use a persistent object cache drop-in to persist the object cache between requests.
6 |
7 | [Read the codex article](https://codex.wordpress.org/Class_Reference/WP_Object_Cache) for more detail.
8 |
9 | ### EXAMPLES
10 |
11 | # Set cache.
12 | $ wp cache set my_key my_value my_group 300
13 | Success: Set object 'my_key' in group 'my_group'.
14 |
15 | # Get cache.
16 | $ wp cache get my_key my_group
17 | my_value
18 |
19 |
20 |
--------------------------------------------------------------------------------
/commands/cache/flush-group.md:
--------------------------------------------------------------------------------
1 | # wp cache flush-group
2 |
3 | Removes all cache items in a group, if the object cache implementation supports it.
4 |
5 | ### OPTIONS
6 |
7 | <group>
8 | : Cache group key.
9 |
10 | ### EXAMPLES
11 |
12 | # Clear cache group.
13 | $ wp cache flush-group my_group
14 | Success: Cache group 'my_group' was flushed.
15 |
16 | ### GLOBAL PARAMETERS
17 |
18 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
19 |
20 | | **Argument** | **Description** |
21 | |:----------------|:-----------------------------|
22 | | `--path=` | Path to the WordPress files. |
23 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
24 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
25 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
26 | | `--user=` | Set the WordPress user. |
27 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
28 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
29 | | `--skip-packages` | Skip loading all installed packages. |
30 | | `--require=` | Load PHP file before running the command (may be used more than once). |
31 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
32 | | `--context=` | Load WordPress in a given context. |
33 | | `--[no-]color` | Whether to colorize the output. |
34 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
35 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
36 | | `--quiet` | Suppress informational messages. |
37 |
--------------------------------------------------------------------------------
/commands/cap.md:
--------------------------------------------------------------------------------
1 | # wp cap
2 |
3 | Adds, removes, and lists capabilities of a user role.
4 |
5 | See references for [Roles and Capabilities](https://codex.wordpress.org/Roles_and_Capabilities) and [WP User class](https://codex.wordpress.org/Class_Reference/WP_User).
6 |
7 | ### EXAMPLES
8 |
9 | # Add 'spectate' capability to 'author' role.
10 | $ wp cap add 'author' 'spectate'
11 | Success: Added 1 capability to 'author' role.
12 |
13 | # Add all caps from 'editor' role to 'author' role.
14 | $ wp cap list 'editor' | xargs wp cap add 'author'
15 | Success: Added 24 capabilities to 'author' role.
16 |
17 | # Remove all caps from 'editor' role that also appear in 'author' role.
18 | $ wp cap list 'author' | xargs wp cap remove 'editor'
19 | Success: Removed 34 capabilities from 'editor' role.
20 |
21 |
22 |
--------------------------------------------------------------------------------
/commands/cap/remove.md:
--------------------------------------------------------------------------------
1 | # wp cap remove
2 |
3 | Removes capabilities from a given role.
4 |
5 | ### OPTIONS
6 |
7 | <role>
8 | : Key for the role.
9 |
10 | <cap>...
11 | : One or more capabilities to remove.
12 |
13 | ### EXAMPLES
14 |
15 | # Remove 'spectate' capability from 'author' role.
16 | $ wp cap remove author spectate
17 | Success: Removed 1 capability from 'author' role.
18 |
19 | ### GLOBAL PARAMETERS
20 |
21 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
22 |
23 | | **Argument** | **Description** |
24 | |:----------------|:-----------------------------|
25 | | `--path=` | Path to the WordPress files. |
26 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
27 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
28 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
29 | | `--user=` | Set the WordPress user. |
30 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
31 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
32 | | `--skip-packages` | Skip loading all installed packages. |
33 | | `--require=` | Load PHP file before running the command (may be used more than once). |
34 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
35 | | `--context=` | Load WordPress in a given context. |
36 | | `--[no-]color` | Whether to colorize the output. |
37 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
38 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
39 | | `--quiet` | Suppress informational messages. |
40 |
--------------------------------------------------------------------------------
/commands/cli.md:
--------------------------------------------------------------------------------
1 | # wp cli
2 |
3 | Reviews current WP-CLI info, checks for updates, or views defined aliases.
4 |
5 | Unless overridden, these commands run on the `before_wp_load` hook, just before the WP load process begins.
6 |
7 | ### EXAMPLES
8 |
9 | # Display the version currently installed.
10 | $ wp cli version
11 | WP-CLI 0.24.1
12 |
13 | # Check for updates to WP-CLI.
14 | $ wp cli check-update
15 | Success: WP-CLI is at the latest version.
16 |
17 | # Update WP-CLI to the latest stable release.
18 | $ wp cli update
19 | You have version 0.24.0. Would you like to update to 0.24.1? [y/n] y
20 | Downloading from https://github.com/wp-cli/wp-cli/releases/download/v0.24.1/wp-cli-0.24.1.phar...
21 | New version works. Proceeding to replace.
22 | Success: Updated WP-CLI to 0.24.1.
23 |
24 | # Clear the internal WP-CLI cache.
25 | $ wp cli cache clear
26 | Success: Cache cleared.
27 |
28 |
29 |
--------------------------------------------------------------------------------
/commands/cli/alias.md:
--------------------------------------------------------------------------------
1 | # wp cli alias
2 |
3 | Retrieves, sets and updates aliases for WordPress Installations.
4 |
5 | Unless overridden, these commands run on the `before_wp_load` hook, just before the WP load process begins.
6 |
7 | Aliases are shorthand references to WordPress installs. For instance, `@dev` could refer to a development install and `@prod` could refer to a production install. This command gives you and option to add, update and delete, the registered aliases you have available.
8 |
9 | ### EXAMPLES
10 |
11 | # List alias information.
12 | $ wp cli alias list
13 | list
14 | ---
15 | @all: Run command against every registered alias.
16 | @local:
17 | user: wpcli
18 | path: /Users/wpcli/sites/testsite
19 |
20 | # Get alias information.
21 | $ wp cli alias get @dev
22 | ssh: dev@somedeve.env:12345/home/dev/
23 |
24 | # Add alias.
25 | $ wp cli alias add @prod --set-ssh=login@host --set-path=/path/to/wordpress/install/ --set-user=wpcli
26 | Success: Added '@prod' alias.
27 |
28 | # Update alias.
29 | $ wp cli alias update @prod --set-user=newuser --set-path=/new/path/to/wordpress/install/
30 | Success: Updated 'prod' alias.
31 |
32 | # Delete alias.
33 | $ wp cli alias delete @prod
34 | Success: Deleted '@prod' alias.
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/commands/cli/alias/get.md:
--------------------------------------------------------------------------------
1 | # wp cli alias get
2 |
3 | Gets the value for an alias.
4 |
5 | This command runs on the `before_wp_load` hook, just before the WP load process begins.
6 |
7 | ### OPTIONS
8 |
9 | <key>
10 | : Key for the alias.
11 |
12 | ### EXAMPLES
13 |
14 | # Get alias.
15 | $ wp cli alias get @prod
16 | ssh: dev@somedeve.env:12345/home/dev/
17 |
18 | ### GLOBAL PARAMETERS
19 |
20 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
21 |
22 | | **Argument** | **Description** |
23 | |:----------------|:-----------------------------|
24 | | `--path=` | Path to the WordPress files. |
25 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
26 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
27 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
28 | | `--user=` | Set the WordPress user. |
29 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
30 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
31 | | `--skip-packages` | Skip loading all installed packages. |
32 | | `--require=` | Load PHP file before running the command (may be used more than once). |
33 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
34 | | `--context=` | Load WordPress in a given context. |
35 | | `--[no-]color` | Whether to colorize the output. |
36 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
37 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
38 | | `--quiet` | Suppress informational messages. |
39 |
--------------------------------------------------------------------------------
/commands/cli/cache.md:
--------------------------------------------------------------------------------
1 | # wp cli cache
2 |
3 | Manages the internal WP-CLI cache,.
4 |
5 | Unless overridden, these commands run on the `before_wp_load` hook, just before the WP load process begins.
6 |
7 | ### EXAMPLES
8 |
9 | # Remove all cached files.
10 | $ wp cli cache clear
11 | Success: Cache cleared.
12 |
13 | # Remove all cached files except for the newest version of each one.
14 | $ wp cli cache prune
15 | Success: Cache pruned.
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/commands/cli/cache/clear.md:
--------------------------------------------------------------------------------
1 | # wp cli cache clear
2 |
3 | Clears the internal cache.
4 |
5 | This command runs on the `before_wp_load` hook, just before the WP load process begins.
6 |
7 | ### EXAMPLES
8 |
9 | $ wp cli cache clear
10 | Success: Cache cleared.
11 |
12 | ### GLOBAL PARAMETERS
13 |
14 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
15 |
16 | | **Argument** | **Description** |
17 | |:----------------|:-----------------------------|
18 | | `--path=` | Path to the WordPress files. |
19 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
20 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
21 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
22 | | `--user=` | Set the WordPress user. |
23 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
24 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
25 | | `--skip-packages` | Skip loading all installed packages. |
26 | | `--require=` | Load PHP file before running the command (may be used more than once). |
27 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
28 | | `--context=` | Load WordPress in a given context. |
29 | | `--[no-]color` | Whether to colorize the output. |
30 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
31 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
32 | | `--quiet` | Suppress informational messages. |
33 |
--------------------------------------------------------------------------------
/commands/cli/cache/prune.md:
--------------------------------------------------------------------------------
1 | # wp cli cache prune
2 |
3 | Prunes the internal cache.
4 |
5 | This command runs on the `before_wp_load` hook, just before the WP load process begins.
6 |
7 | Removes all cached files except for the newest version of each one.
8 |
9 | ### EXAMPLES
10 |
11 | $ wp cli cache prune
12 | Success: Cache pruned.
13 |
14 | ### GLOBAL PARAMETERS
15 |
16 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
17 |
18 | | **Argument** | **Description** |
19 | |:----------------|:-----------------------------|
20 | | `--path=` | Path to the WordPress files. |
21 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
22 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
23 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
24 | | `--user=` | Set the WordPress user. |
25 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
26 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
27 | | `--skip-packages` | Skip loading all installed packages. |
28 | | `--require=` | Load PHP file before running the command (may be used more than once). |
29 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
30 | | `--context=` | Load WordPress in a given context. |
31 | | `--[no-]color` | Whether to colorize the output. |
32 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
33 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
34 | | `--quiet` | Suppress informational messages. |
35 |
--------------------------------------------------------------------------------
/commands/cli/cmd-dump.md:
--------------------------------------------------------------------------------
1 | # wp cli cmd-dump
2 |
3 | Dumps the list of installed commands, as JSON.
4 |
5 | This command runs on the `before_wp_load` hook, just before the WP load process begins.
6 |
7 | ### EXAMPLES
8 |
9 | # Dump the list of installed commands.
10 | $ wp cli cmd-dump
11 | {"name":"wp","description":"Manage WordPress through the command-line.","longdesc":"\n\n## GLOBAL PARAMETERS
12 |
13 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
14 |
15 | | **Argument** | **Description** |
16 | |:----------------|:-----------------------------|
17 | | `--path=` | Path to the WordPress files. |
18 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
19 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
20 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
21 | | `--user=` | Set the WordPress user. |
22 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
23 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
24 | | `--skip-packages` | Skip loading all installed packages. |
25 | | `--require=` | Load PHP file before running the command (may be used more than once). |
26 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
27 | | `--context=` | Load WordPress in a given context. |
28 | | `--[no-]color` | Whether to colorize the output. |
29 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
30 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
31 | | `--quiet` | Suppress informational messages. |
32 |
--------------------------------------------------------------------------------
/commands/cli/version.md:
--------------------------------------------------------------------------------
1 | # wp cli version
2 |
3 | Prints WP-CLI version.
4 |
5 | This command runs on the `before_wp_load` hook, just before the WP load process begins.
6 |
7 | ### EXAMPLES
8 |
9 | # Display CLI version.
10 | $ wp cli version
11 | WP-CLI 0.24.1
12 |
13 | ### GLOBAL PARAMETERS
14 |
15 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
16 |
17 | | **Argument** | **Description** |
18 | |:----------------|:-----------------------------|
19 | | `--path=` | Path to the WordPress files. |
20 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
21 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
22 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
23 | | `--user=` | Set the WordPress user. |
24 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
25 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
26 | | `--skip-packages` | Skip loading all installed packages. |
27 | | `--require=` | Load PHP file before running the command (may be used more than once). |
28 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
29 | | `--context=` | Load WordPress in a given context. |
30 | | `--[no-]color` | Whether to colorize the output. |
31 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
32 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
33 | | `--quiet` | Suppress informational messages. |
34 |
--------------------------------------------------------------------------------
/commands/comment.md:
--------------------------------------------------------------------------------
1 | # wp comment
2 |
3 | Creates, updates, deletes, and moderates comments.
4 |
5 | ### EXAMPLES
6 |
7 | # Create a new comment.
8 | $ wp comment create --comment_post_ID=15 --comment_content="hello blog" --comment_author="wp-cli"
9 | Success: Created comment 932.
10 |
11 | # Update an existing comment.
12 | $ wp comment update 123 --comment_author='That Guy'
13 | Success: Updated comment 123.
14 |
15 | # Delete an existing comment.
16 | $ wp comment delete 1337 --force
17 | Success: Deleted comment 1337.
18 |
19 | # Trash all spam comments.
20 | $ wp comment delete $(wp comment list --status=spam --format=ids)
21 | Success: Trashed comment 264.
22 | Success: Trashed comment 262.
23 |
24 |
25 |
--------------------------------------------------------------------------------
/commands/comment/approve.md:
--------------------------------------------------------------------------------
1 | # wp comment approve
2 |
3 | Approves a comment.
4 |
5 | ### OPTIONS
6 |
7 | <id>...
8 | : The IDs of the comments to approve.
9 |
10 | ### EXAMPLES
11 |
12 | # Approve comment.
13 | $ wp comment approve 1337
14 | Success: Approved comment 1337.
15 |
16 | ### GLOBAL PARAMETERS
17 |
18 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
19 |
20 | | **Argument** | **Description** |
21 | |:----------------|:-----------------------------|
22 | | `--path=` | Path to the WordPress files. |
23 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
24 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
25 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
26 | | `--user=` | Set the WordPress user. |
27 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
28 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
29 | | `--skip-packages` | Skip loading all installed packages. |
30 | | `--require=` | Load PHP file before running the command (may be used more than once). |
31 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
32 | | `--context=` | Load WordPress in a given context. |
33 | | `--[no-]color` | Whether to colorize the output. |
34 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
35 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
36 | | `--quiet` | Suppress informational messages. |
37 |
--------------------------------------------------------------------------------
/commands/comment/exists.md:
--------------------------------------------------------------------------------
1 | # wp comment exists
2 |
3 | Verifies whether a comment exists.
4 |
5 | Displays a success message if the comment does exist.
6 |
7 | ### OPTIONS
8 |
9 | <id>
10 | : The ID of the comment to check.
11 |
12 | ### EXAMPLES
13 |
14 | # Check whether comment exists.
15 | $ wp comment exists 1337
16 | Success: Comment with ID 1337 exists.
17 |
18 | ### GLOBAL PARAMETERS
19 |
20 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
21 |
22 | | **Argument** | **Description** |
23 | |:----------------|:-----------------------------|
24 | | `--path=` | Path to the WordPress files. |
25 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
26 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
27 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
28 | | `--user=` | Set the WordPress user. |
29 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
30 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
31 | | `--skip-packages` | Skip loading all installed packages. |
32 | | `--require=` | Load PHP file before running the command (may be used more than once). |
33 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
34 | | `--context=` | Load WordPress in a given context. |
35 | | `--[no-]color` | Whether to colorize the output. |
36 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
37 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
38 | | `--quiet` | Suppress informational messages. |
39 |
--------------------------------------------------------------------------------
/commands/comment/meta.md:
--------------------------------------------------------------------------------
1 | # wp comment meta
2 |
3 | Adds, updates, deletes, and lists comment custom fields.
4 |
5 | ### EXAMPLES
6 |
7 | # Set comment meta
8 | $ wp comment meta set 123 description "Mary is a WordPress developer."
9 | Success: Updated custom field 'description'.
10 |
11 | # Get comment meta
12 | $ wp comment meta get 123 description
13 | Mary is a WordPress developer.
14 |
15 | # Update comment meta
16 | $ wp comment meta update 123 description "Mary is an awesome WordPress developer."
17 | Success: Updated custom field 'description'.
18 |
19 | # Delete comment meta
20 | $ wp comment meta delete 123 description
21 | Success: Deleted custom field.
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/commands/comment/meta/delete.md:
--------------------------------------------------------------------------------
1 | # wp comment meta delete
2 |
3 | Delete a meta field.
4 |
5 | ### OPTIONS
6 |
7 | <id>
8 | : The ID of the object.
9 |
10 | [<key>]
11 | : The name of the meta field to delete.
12 |
13 | [<value>]
14 | : The value to delete. If omitted, all rows with key will deleted.
15 |
16 | [\--all]
17 | : Delete all meta for the object.
18 |
19 | ### GLOBAL PARAMETERS
20 |
21 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
22 |
23 | | **Argument** | **Description** |
24 | |:----------------|:-----------------------------|
25 | | `--path=` | Path to the WordPress files. |
26 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
27 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
28 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
29 | | `--user=` | Set the WordPress user. |
30 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
31 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
32 | | `--skip-packages` | Skip loading all installed packages. |
33 | | `--require=` | Load PHP file before running the command (may be used more than once). |
34 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
35 | | `--context=` | Load WordPress in a given context. |
36 | | `--[no-]color` | Whether to colorize the output. |
37 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
38 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
39 | | `--quiet` | Suppress informational messages. |
40 |
--------------------------------------------------------------------------------
/commands/comment/recount.md:
--------------------------------------------------------------------------------
1 | # wp comment recount
2 |
3 | Recalculates the comment_count value for one or more posts.
4 |
5 | ### OPTIONS
6 |
7 | <id>...
8 | : IDs for one or more posts to update.
9 |
10 | ### EXAMPLES
11 |
12 | # Recount comment for the post.
13 | $ wp comment recount 123
14 | Updated post 123 comment count to 67.
15 |
16 | ### GLOBAL PARAMETERS
17 |
18 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
19 |
20 | | **Argument** | **Description** |
21 | |:----------------|:-----------------------------|
22 | | `--path=` | Path to the WordPress files. |
23 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
24 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
25 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
26 | | `--user=` | Set the WordPress user. |
27 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
28 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
29 | | `--skip-packages` | Skip loading all installed packages. |
30 | | `--require=` | Load PHP file before running the command (may be used more than once). |
31 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
32 | | `--context=` | Load WordPress in a given context. |
33 | | `--[no-]color` | Whether to colorize the output. |
34 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
35 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
36 | | `--quiet` | Suppress informational messages. |
37 |
--------------------------------------------------------------------------------
/commands/comment/spam.md:
--------------------------------------------------------------------------------
1 | # wp comment spam
2 |
3 | Marks a comment as spam.
4 |
5 | ### OPTIONS
6 |
7 | <id>...
8 | : The IDs of the comments to mark as spam.
9 |
10 | ### EXAMPLES
11 |
12 | # Spam comment.
13 | $ wp comment spam 1337
14 | Success: Marked as spam comment 1337.
15 |
16 | ### GLOBAL PARAMETERS
17 |
18 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
19 |
20 | | **Argument** | **Description** |
21 | |:----------------|:-----------------------------|
22 | | `--path=` | Path to the WordPress files. |
23 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
24 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
25 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
26 | | `--user=` | Set the WordPress user. |
27 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
28 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
29 | | `--skip-packages` | Skip loading all installed packages. |
30 | | `--require=` | Load PHP file before running the command (may be used more than once). |
31 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
32 | | `--context=` | Load WordPress in a given context. |
33 | | `--[no-]color` | Whether to colorize the output. |
34 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
35 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
36 | | `--quiet` | Suppress informational messages. |
37 |
--------------------------------------------------------------------------------
/commands/comment/status.md:
--------------------------------------------------------------------------------
1 | # wp comment status
2 |
3 | Gets the status of a comment.
4 |
5 | ### OPTIONS
6 |
7 | <id>
8 | : The ID of the comment to check.
9 |
10 | ### EXAMPLES
11 |
12 | # Get status of comment.
13 | $ wp comment status 1337
14 | approved
15 |
16 | ### GLOBAL PARAMETERS
17 |
18 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
19 |
20 | | **Argument** | **Description** |
21 | |:----------------|:-----------------------------|
22 | | `--path=` | Path to the WordPress files. |
23 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
24 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
25 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
26 | | `--user=` | Set the WordPress user. |
27 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
28 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
29 | | `--skip-packages` | Skip loading all installed packages. |
30 | | `--require=` | Load PHP file before running the command (may be used more than once). |
31 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
32 | | `--context=` | Load WordPress in a given context. |
33 | | `--[no-]color` | Whether to colorize the output. |
34 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
35 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
36 | | `--quiet` | Suppress informational messages. |
37 |
--------------------------------------------------------------------------------
/commands/comment/trash.md:
--------------------------------------------------------------------------------
1 | # wp comment trash
2 |
3 | Trashes a comment.
4 |
5 | ### OPTIONS
6 |
7 | <id>...
8 | : The IDs of the comments to trash.
9 |
10 | ### EXAMPLES
11 |
12 | # Trash comment.
13 | $ wp comment trash 1337
14 | Success: Trashed comment 1337.
15 |
16 | ### GLOBAL PARAMETERS
17 |
18 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
19 |
20 | | **Argument** | **Description** |
21 | |:----------------|:-----------------------------|
22 | | `--path=` | Path to the WordPress files. |
23 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
24 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
25 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
26 | | `--user=` | Set the WordPress user. |
27 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
28 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
29 | | `--skip-packages` | Skip loading all installed packages. |
30 | | `--require=` | Load PHP file before running the command (may be used more than once). |
31 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
32 | | `--context=` | Load WordPress in a given context. |
33 | | `--[no-]color` | Whether to colorize the output. |
34 | | `--debug[=]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
35 | | `--prompt[=]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
36 | | `--quiet` | Suppress informational messages. |
37 |
--------------------------------------------------------------------------------
/commands/comment/unapprove.md:
--------------------------------------------------------------------------------
1 | # wp comment unapprove
2 |
3 | Unapproves a comment.
4 |
5 | ### OPTIONS
6 |
7 | <id>...
8 | : The IDs of the comments to unapprove.
9 |
10 | ### EXAMPLES
11 |
12 | # Unapprove comment.
13 | $ wp comment unapprove 1337
14 | Success: Unapproved comment 1337.
15 |
16 | ### GLOBAL PARAMETERS
17 |
18 | These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
19 |
20 | | **Argument** | **Description** |
21 | |:----------------|:-----------------------------|
22 | | `--path=` | Path to the WordPress files. |
23 | | `--url=` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
24 | | `--ssh=[:][@][:][]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
25 | | `--http=` | Perform operation against a remote WordPress installation over HTTP. |
26 | | `--user=` | Set the WordPress user. |
27 | | `--skip-plugins[=]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
28 | | `--skip-themes[=]` | Skip loading all themes, or a comma-separated list of themes. |
29 | | `--skip-packages` | Skip loading all installed packages. |
30 | | `--require=` | Load PHP file before running the command (may be used more than once). |
31 | | `--exec=` | Execute PHP code before running the command (may be used more than once). |
32 | | `--context=