WP-CLI is a command-line tool for managing WordPress installations. It allows you to download, configure, and install WordPress without using a browser or control panel.
This method requires SSH access to the server.
Change to the directory where WordPress should be installed - typically public_html or a subdirectory:
cd ~/public_html
wp core download
This downloads the latest version of WordPress into the current directory.
wp config create --dbname=your_database --dbuser=your_db_user --dbpass='your_db_password' --dbhost=localhost
Replace your_database, your_db_user, and your_db_password with the actual database credentials. The password must be wrapped in single quotes - database passwords often contain special characters such as !, =, or $ that the shell will misinterpret if the value is unquoted or double-quoted.
wp core install --url="https://example.com" --title="Site Title" --admin_user="admin" --admin_password="securepassword" --admin_email="[email protected]"
Replace the values with the appropriate site URL, title, and admin credentials.
wp core version
This should return the installed WordPress version, confirming the installation was successful.
| Command | Description |
|---|---|
wp plugin list | List all installed plugins |
wp plugin install <plugin> | Install a plugin by slug |
wp theme list | List all installed themes |
wp user list | List all WordPress users |
wp cache flush | Flush the WordPress object cache |
wp core update | Update WordPress to the latest version |
If you see an error like:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 36864 bytes) in phar:///usr/local/bin/wp/...
This means PHP's memory limit (128MB by default) is too low for WP-CLI to complete the operation. Prefix your command with php -d memory_limit=512M to override the limit for that run:
php -d memory_limit=512M /usr/local/bin/wp core download
php -d memory_limit=512M /usr/local/bin/wp core install --url="https://example.com" ...
This only applies to the single command - it does not change the server's PHP configuration permanently.
--allow-root flag may be required if running commands as the root user, though this is not recommended.No worries, Our experts are here to help.