Hostinger WP-CLI: How to Use the WordPress Command Line Interface
Hostinger supports WP-CLI on all shared WordPress plans via SSH access, and with full root access on VPS plans. Connect via SSH, then use 'wp' commands to manage plugins, run updates, reset passwords, import/export databases, and automate WordPress maintenance tasks without using the admin dashboard.
What Is WP-CLI and Why Use It?
WP-CLI lets you manage WordPress via terminal — update plugins, reset passwords, migrate databases, and automate maintenance without using the web admin.
WP-CLI (WordPress Command Line Interface) lets you manage WordPress from the terminal instead of the web browser admin. It's faster, scriptable, and essential for developers and agencies managing multiple sites.
Common WP-CLI use cases: update all plugins in one command, reset admin passwords without email access, search-replace URLs in database after migration, bulk manage posts, run database optimizations, install WordPress in seconds, and automate maintenance with cron jobs.
How to Access WP-CLI on Hostinger
Hostinger includes WP-CLI on shared hosting plans via SSH access:
- Enable SSH in hPanel → Advanced → SSH Access → Enable
- Get your SSH details (hostname, port, username) from hPanel
- Connect:
ssh username@hostname -p port - Navigate to your WordPress directory:
cd public_html(or your WordPress subdirectory) - Test WP-CLI:
wp --info
WP-CLI is pre-installed on Hostinger's servers — no manual installation needed. On VPS plans, you have full control and can install/update WP-CLI manually.
Essential WP-CLI Commands for Hostinger WordPress
Plugin Management:
# Update all plugins
wp plugin update --all
# Install a plugin
wp plugin install yoast-seo --activate
# Deactivate all plugins (useful for debugging)
wp plugin deactivate --allUser Management:
# Reset admin password
wp user update admin --user_pass=NewSecurePassword123!
# List all users
wp user list --fields=ID,user_login,rolesDatabase Operations:
# Search and replace URLs (migration)
wp search-replace 'https://oldsite.com' 'https://newsite.com' --all-tables
# Optimize database
wp db optimize
# Export database
wp db export backup.sqlAutomating WordPress Maintenance with WP-CLI
Set up automated maintenance using Hostinger's Cron Jobs (hPanel → Advanced → Cron Jobs):
Weekly plugin updates:
0 2 * * 1 cd /home/username/public_html && wp plugin update --all --quietDaily database optimization:
0 3 * * * cd /home/username/public_html && wp db optimize --quietMonthly core updates:
0 4 1 * * cd /home/username/public_html && wp core update --quietReplace username with your Hostinger account username and adjust the WordPress path if your installation is in a subdirectory.
Using WP-CLI for WordPress Migration
WP-CLI simplifies the database URL replacement that's often the trickiest part of WordPress migration:
# After importing database to new host:
# Replace all instances of old URL with new URL in all tables
wp search-replace 'https://old-domain.com' 'https://new-domain.com' --all-tables --report-changed-only
# Verify WordPress is working
wp post list --post_status=publish
wp option get siteurl
wp option get home
# Flush cache
wp cache flush
wp litespeed-purge --allThe search-replace command handles all database tables including serialized data — something phpMyAdmin's find-and-replace feature cannot do safely.
Frequently Asked Questions
Does Hostinger shared hosting support WP-CLI?
Yes — WP-CLI is pre-installed on Hostinger shared hosting plans. Enable SSH access in hPanel → Advanced → SSH Access, then connect via terminal and use 'wp' commands from your WordPress directory.
How do I enable SSH on Hostinger for WP-CLI?
In hPanel, go to Advanced → SSH Access → Enable SSH Access. Note your SSH hostname, port (usually 65002), and username. Connect with: ssh username@hostname -p 65002. Once connected, navigate to public_html and run 'wp --info' to confirm WP-CLI is available.
Can I use WP-CLI to update WordPress on Hostinger?
Yes — run 'wp core update' to update WordPress core. 'wp plugin update --all' updates all plugins. 'wp theme update --all' updates all themes. These are much faster than the web admin interface, especially for sites with many plugins.
Is WP-CLI available on Hostinger VPS?
Yes — on Hostinger VPS you have full root access and can install/update WP-CLI manually. Run: curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x wp-cli.phar && mv wp-cli.phar /usr/local/bin/wp. Then use 'wp' globally.
What is the WP-CLI path on Hostinger shared hosting?
WP-CLI is available as 'wp' globally on Hostinger shared hosting. No path configuration needed — just connect via SSH, navigate to your WordPress directory (usually ~/public_html), and run 'wp [command]'. If WP-CLI isn't available, contact Hostinger support.
Get Hostinger WordPress with SSH & WP-CLI
Full SSH access and WP-CLI support on all WordPress plans. From $2.99/mo.
Try Hostinger WordPressHenry Fontaine
Chief of Staff & COO, RocketLabs
AI-native operator building the future of search visibility. Part of the team behind 3 tech exits and 400+ programmatic SEO deployments.