Content type: Handbook

  • WP_CLIUtilslaunch_editor_for_input()

    Launch system’s $EDITOR for the user to edit some text. Usage WP_CLI\Utils\launch_editor_for_input( $input, $title = WP-CLI, $ext = tmp ) $input (string) Some form of text to edit (e.g. post content). $title (string) Title to display in the editor. $ext (string) Extension to use with the temp file. @return (string|bool) text, if file is saved…

  • WP_CLIUtilsmake_progress_bar()

    Create a progress bar to display percent completion of a given operation. Usage WP_CLI\Utils\make_progress_bar( $message, $count, $interval = 100 ) $message (string) Text to display before the progress bar. $count (integer) Total number of ticks to be performed. $interval (int) Optional. The interval in milliseconds between updates. Default 100. @return (\cli\progress\Bar|\WP_CLI\NoOp) Notes Progress bar is…

  • WP_CLIUtilsnormalize_path()

    Normalize a filesystem path. Usage WP_CLI\Utils\normalize_path( $path ) $path (string) Path to normalize. @return (string) path. Notes On Windows systems, replaces backslashes with forward slashes and forces upper-case drive letters. Allows for two leading slashes for Windows network shares, but ensures that all other duplicate slashes are reduced to a single one. Ensures upper-case drive…

  • WP_CLIUtilsparse_ssh_url()

    Parse a SSHSSH Secure SHell – a protocol for securely connecting to a remote system in addition to or in place of a password. url for its host, port, and path. Usage WP_CLI\Utils\parse_ssh_url( $url, $component = -1 ) $url (string) $component (int) @return (mixed) Notes Similar to parse_url(), but adds support for defined SSH aliases.…

  • WP_CLIUtilsparse_str_to_argv()

    Parse a string of command line arguments into an $argv-esqe variable. Usage WP_CLI\Utils\parse_str_to_argv( $arguments ) $arguments (string) @return (array<string>) Internal APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. documentation is generated from the WP-CLIWP-CLI WP-CLI is…

  • WP_CLIUtilsproc_open_compat()

    Windows compatible proc_open(). Works around bug in PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. https://www.php.net/manual/en/index.php, and also deals with *nix-like ENV_VAR=blah cmd environment variable prefixes. Usage WP_CLI\Utils\proc_open_compat( $cmd, $descriptorspec, $pipes, $cwd = null,…

  • WP_CLIUtilshttp_request()

    Make a HTTPHTTP HTTP is an acronym for Hyper Text Transfer Protocol. HTTP is the underlying protocol used by the World Wide Web and this protocol defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands. request to a remote URLURL A specific web…

  • 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…

  • 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 APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. documentation is generated from the WP-CLIWP-CLI WP-CLI is the Command Line Interface…

  • WP_CLIUtilsesc_like()

    First half of escaping for LIKE special characters % and _ before preparing for MySQLMySQL MySQL is a relational database management system. A database is a structured collection of data where content, configuration and other options are stored. https://www.mysql.com. Usage WP_CLI\Utils\esc_like( $text ) $text (string) The raw text to be escaped. The input typed by…