WordPress Help

Official documentation, learning resources, and contributor guides collected from WordPress.org.

  • Given a database

    Creates an empty database. Usage Has no effect when tests run with SQLite. Scenario: My example scenario Given a database … Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related Given an empty directory – Creates an empty directory. Given /^an? (empty|non-existent) ([^\s]+)…

    Read guide

  • Given a dependency on current wp-cli

    Add wp-cli/wp-cli as a Composer dependency. Usage Scenario: My example scenario Given a WP installation with Composer And a dependency on current wp-cli Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related Given an empty directory – Creates an empty directory. Given /^an?…

    Read guide

  • Given /^a downloaded Phar with (?:the same version|version "([^"]+)")$/

    Download a specific WP-CLI Phar version from GitHub. Usage Scenario: My example scenario Given an empty directory And a downloaded Phar with version “2.11.0” Scenario: My other scenario Given an empty directory And a downloaded Phar with the same version Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements,…

    Read guide

  • Given a misconfigured WP_CONTENT_DIR constant directory

    Modify wp-config.php to set WP_CONTENT_DIR to an empty string. Usage Scenario: My example scenario Given a WP install And a misconfigured WP_CONTENT_DIR constant directory Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related Given an empty directory – Creates an empty directory. Given…

    Read guide

  • Given /^a new Phar with (?:the same version|version "([^"]+)")$/

    Build a new WP-CLI Phar file with a given version. Usage Scenario: My example scenario Given an empty directory And a new Phar with version “2.11.0” Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related Given an empty directory – Creates an empty…

    Read guide

  • Given a WP install(ation) in :subdir

    Installs WordPress in a given directory. Usage Scenario: My example scenario Given a WP installation in ‘foo’ … Scenario: My other scenario Given a WP install in ‘bar’ … Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related Given an empty directory –…

    Read guide

  • Given a PHP built-in web server to serve :subdir

    Start a PHP built-in web server in the given subdirectory. Usage Scenario: My example scenario Given a WP installation And a PHP built-in web server to serve ‘WordPress’ Behat steps documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related Given an empty directory – Creates…

    Read guide

  • WP_CLIUtilshttp_request()

    Make a HTTP request to a remote URL. Usage WP_CLI\Utils\http_request( $method, $url, $data = null, $headers = [], $options = [] ) $method (string) HTTP method (GET, POST, DELETE, etc.). $url (string) URL to make the HTTP request to. $data (array|null) Data to send either as a query string for GET/HEAD requests, or in the…

    Read guide

  • WP_CLIUtilsisPiped()

    Checks whether the output of the current script is a TTY or a pipe / redirect Usage WP_CLI\Utils\isPiped() @return (bool) Notes Returns true if STDOUT output is being redirected to a pipe or a file; false is output is being sent directly to the terminal. If an env variable SHELL_PIPE exists, the returned result depends…

    Read guide

  • WP_CLIUtilsget_temp_dir()

    Get the system’s temp directory. Warns user if it isn’t writable. Usage WP_CLI\Utils\get_temp_dir() @return (string) Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request. Related WP_CLI\Utils\get_home_dir() – Get the home directory. WP_CLI\Utils\trailingslashit() – Appends a trailing slash. WP_CLI\Utils\normalize_path() – Normalize a filesystem path. WP_CLI\Utils\get_php_binary()…

    Read guide