Content type: Handbook

  • Contributing

    Welcome and thanks! We appreciate you taking the initiative to contribute to WP-CLI. It’s because of you, and the community around you, that WP-CLI is such a great project. Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at…

  • Write a check for asserting the value of a given constant

    One of the check types included in wp doctor is Constant_Definition, or the ability to assert that a given constant is either defined, a specific value, or falsy. The check type is in use by a couple of the default diagnostic checks, and you can use the Constant_Definition check type in your custom doctor.yml configuration…

  • Write a check for verifying contents of WordPress files

    One of the check types included in wp doctor is File_Contents, or the ability to check all or a selection of WordPress files for a given regex pattern. The check type is in use by a couple of the default diagnostic checks, and you can use the File_Contents check type in your custom doctor.yml configuration…

  • Write a check for asserting the value of a given option

    One of the check types included in wp doctor is Option_Value, or the ability to assert that a given option is a specific value. The check type is in use by a couple of the default diagnostic checks, and you can use the Option_Value check type in your custom doctor.yml configuration file. As an example,…

  • Check status of a given plugin

    One of the check types included in wp doctor is Plugin_Status, or the ability to assert that a given plugin should be active, installed, or uninstalled. Although the check type isn’t use by any of the default diagnostic checks, you can use the Plugin_Status check type in your custom doctor.yml configuration file. As an example,…

  • Write a custom check to perform an arbitrary assertion

    Because wp doctor checks are built on top of a foundational abstraction, it’s relatively straightforward for you to write your own custom check. The basic requirement is that you create a class extending runcommand\Doctor\Checks\Check that implements a run() method. The run() must set a status and message based on whatever procedural logic As an example,…

  • Common Issues

    Error: Can’t connect to the database A few possibilities: a) you’re using MAMP, but WP-CLI is not using the MAMP PHP binary. You can check which PHP WP-CLI is using by running wp –info. If you need to specify an alternate PHP binary, see using a custom PHP binary. b) it’s a WordPress multisite install.…

  • Config

    WP-CLI has a series of global parameters (e.g. –path=<path> and –user=<user>) which work with all commands. They are called global parameters because they affect how WP-CLI interacts with WordPress, and have the same behavior across all commands. # `–user=<user>` sets request to a specific WordPress user $ wp –user=wpcli eval ‘echo wp_get_current_user()->user_email;’ [email protected] For repeated…

  • Documentation Standards

    To promote similarity and consistency between WP-CLI commands, we’ve produced these documentation standards we’d encourage you to follow. Commonality is a key component of usability, because it reduces the mental overhead required when switching between commands. Pull requests against the WP-CLI project are reviewed for these standards. Please follow these standards for your custom commands…

  • Default doctor diagnostic checks

    Although it’s power comes from its ability to be customized, wp doctor includes a number of default diagnostic checks considered to be recommendations for production websites. Use wp doctor list to view these default checks: name description autoload-options-size Warns when autoloaded options size exceeds threshold of 900 kb. constant-savequeries-falsy Confirms expected state of the SAVEQUERIES…