WordPress is incredibly easy to use, but for more advanced users clicking through all the different screens in the WordPress admin can be cumbersome. Those users may want to consider using SSH to manage their sites via the WordPress command line interface, WP-CLI.
This post covers the basics of SSH and WP-CLI, including who should use it, when it’s helpful, and advice on when to avoid it.
What is SSH?
Secure Shell, or SSH, is a protocol that allows you to connect to a web server. A shell is a computer program with a command line interface. Instead of controlling the web server with a typical graphical user interface, the user enters everything by typing commands.
To learn more about how to use SSH commands, consider these third-party resources:
- Ubuntu’s Command Line for Beginners Tutorial
- freeCodeCamp’s Linux Commands Handbook
- Microsoft’s Shell Course
To use SSH, you need a web host that supports it. Pressable offers SSH access to all customers. Follow these instructions for setting up your SSH credentials and accessing command-line tools.
What is WP-CLI?
WP-CLI extends the command line interface for managing your WordPress website. WP-CLI allows you to install and update your WordPress software as well as install and manage plugins and themes. Read the official WordPress documentation for WP-CLI for more information about all the available options.
To utilize WP-CLI, you’ll need SSH access and a server with WP-CLI installed. You can follow these instructions for installing the WP-CLI or ask your web host about it. WP-CLI comes pre-installed and enabled on all Pressable accounts.
When is WP-CLI Useful?
WP-CLI is most helpful when setting up a new site or troubleshooting a site error.
Using the WordPress Command-Line Interface to Set Up a New Site
You can install a new WordPress instance using the command line interface. Just follow these instructions. If you have Managed WordPress hosting, it’s likely easier and faster to set up a new WordPress installation using your hosting dashboard.
SSH access at Pressable is configured on a per-site basis. You’ll need to set up a new site before you get SSH access. Pressable clients don’t need to use the command line interface to install WordPress – use the MyPressable Dashboard instead.
Useful WP-CLI Commands for New Site Setups
WP-CLI helps during the setup of a new site by allowing you to install and activate themes and plugins.
wp plugin install
Use this command to install one or more plugins. Just list the plugin slug at the end. You can find the slug in the WordPress plugin directory. The slug is what comes after plugins/
This command works with more than one plugin. You also can use it to install plugins from a local ZIP file or a URL to a remote zip file.
Add –activate to the end of the line to both install and activate the plugins.
This command is incredibly useful if you develop sites using the same set of plugins. You could install and activate your preferred starter pack of plugins with one line.
wp theme install
The theme install line works the same way as the plugin line. You can download, install, and activate a plugin using the WordPress theme directory slug or a zip file.
Using these two lines together, a developer could install their preferred theme and plugins with just two lines.
Using WP-CLI to Troubleshoot Your Site
Every WordPress site owner and developer hates the 500 Internal Server Error. It’s like the blue screen of death for WordPress sites. WP-CLI is a way to troubleshoot your website when you don’t have access to the traditional WordPress admin.
WP-CLI Commands for Troubleshooting your Website
Use these commands to help identify and fix issues with your site.
This command lists recent PHP errors. It’s a great starting point to see if there is a particular plugin or theme causing the issue.
wp plugin list
This command returns a list of all your installed plugins with their status and version. The list will also include the plugin’s slugs. Make note of the slugs to use them in other commands. Learn more about this command.
wp theme list
This command returns a list of all themes and their status and version. Again, make note of the theme slugs to use them later. Learn more about this command.
wp plugin deactivate
Think a plugin is causing a site error? Deactivate it using this command. Just add the plugin slug at the end of the line. It works the same way as the install command in that you can list multiple plugins in the same command. Learn more about this command.
wp –skip-plugins –skip-themes
If you’re encountering errors and can’t run any commands, use this command to skip loading any theme or plugin code. You can combine this command with others to skip over all plugins and themes, so you can deactivate a problematic plugin:
When to Avoid Using WP-CLI
WP-CLI and SSH, in general, are not beginner friendly. You could damage your site or accidentally delete important files if you don’t know what you’re doing. Even experienced users should consider backing up their site before using SSH commands to make changes.
Pressable clients should note that, due to the complex nature of SSH and WP-CLI, our team can’t provide extensive support for using these tools. You can use the Pressable Support Team to solve issues connecting via SSH, but we don’t offer support or guidance on using specific commands.
If you’re unsure about using SSH, consider making a copy of your site as a staging site. Your Pressable account includes free staging environments and you can test the SSH commands on the staging site before using them on your live site.
Making Developers’ Lives Easier
SSH and WP-CLI access are just another way Pressable supports developers. From advanced tools to an intuitive dashboard for managing multiple sites, Pressable delivers an elevated experience for hosting and managing WordPress websites.
Want to try the platform for yourself? Check out the MyPressable Playground to see how it works.