Automate WordPress. One Script at a Time.

Update WordPress Plugins & Themes

Automate updates across one or multiple WordPress installs using WP-CLI. This script updates WordPress core, all plugins, and themes — ideal for cron jobs or low-maintenance environments.

#!/bin/bash

# === Configuration ===
WP_PATH="/var/www/html"  # Path to your WordPress install

# === Navigate to the WP install directory ===
cd "$WP_PATH" || { echo "❌ Error: WP path not found"; exit 1; }

# === Update core ===
echo "⬆️ Updating WordPress core..."
wp core update

# === Update plugins ===
echo "🔌 Updating plugins..."
wp plugin update --all

# === Update themes ===
echo "🎨 Updating themes..."
wp theme update --all

# === Done ===
echo "✅ All updates complete."
How to Create and Execute This Script

Follow these steps to create and run your WordPress script:

Open Your Terminal

Connect to your server via SSH or open your local terminal.

Create the Script File

Use a text editor like nano to create a new file. For example:

Paste the Script Code

Copy the full script from above and paste it into the terminal. Once done:

  • Press CTRL+O to save
  • Press Enter to confirm the filename
  • Press CTRL+X to exit nano

Make the Script Executable

Run the Script

⚠️ Backup First!

Use our handy script to run a full backup prior to using this script.

Requirements

  • WP-CLI must be installed and accessible from the shell.
  • wp-config.php must be correctly configured (WP-CLI uses it to access the DB).
  • Run this script as a user with permission to access the WP directory and write to the backup folder.