Cookbook

Collection of WP-CLI commands and bash scripts for automating WordPress maintenance. Easily run on one or many WordPress websites using CaptainCore or an SSH script from scratch.


Activate ACF Pro License Key
Replace YOUR_PRO_LICENSE_KEY with your Advanced Custom Fields Pro license key.

Apply HTTPS URLs
Changes HTTP references to HTTPS for a certain domain name.

Changing WordPress database prefix
Changes WordPress database prefix by exporting database, updated references and then re-importing database. Be sure to update db_prefix_new to a new database prefix.

Cleanup bad text encodings within database
In rare case while doing a site migration sometimes characters like are replaced with “. This will clean up the most common encoding issues.

Convert MyISAM database tables to InnoDB
Finds and converts any database tables using MyISAM storage engine to InnoDB.

Delete Inactive Themes
Removes all inactive themes.

Disable Emails
Inserts must-use plugin to disable outgoing emails.

Disk Usage
Overall disk usage within home WordPress directory.

Divi Cache Purge
Purge Divi theme static CSS file cache

Download file from Google Drive shared link
Will download from a Google Drive shared link using wget. Swap out <google-file-id> and <file-name> with Google's unique file ID shown in shared URL and a file name where you want to download it to.

Fetch database autoload size
Generally a good idea to keep your database autoload below 1MB in size. You can see the current usage with the following. For optimizing, I recommend reviewing Kinsta's guide: https://kinsta.com/knowledgebase/wp-options-autoloaded-data/.

Fetch PHP memory limit
WordPress' memory limit can be independently set to anything however will not go over PHP's own limit. This will retrieve PHP's memory limit. Will attempt to retrieve from default location for Kinsta sites then fallback to what PHP's loaded ini file. Please note that sometimes there is a difference between CLI's memory limits and web request limits.

Hunt for certain WordPress user
Search for a certain WordPress user. Will only respond if the account was found. Change user to either the login or email of the person your looking for.

Hunt Unnecessary Files on Kinsta
Returns storage usage of debug.log file and private folder on Kinsta.

Install Events Calendar Pro
Installs The Events Calendar and Event Calendar Pro and activates license.

Kinsta Cache Purge
Purges cache on Kinsta.

MonsterInsights turn off email summaries
Turn off MonsterInsights email summaries if admin user is a certain email address.

Overriding Recovery Emails
Adds RECOVERY_MODE_EMAIL to wp-config.php file.

Search for User by Email Address
Searches for a WordPress user account by email address. Will return the name of the site if found.

Send Test Email
Sends a test email.

Show Kinsta PHP Workers
Lists out current PHP workers on a site hosted with Kinsta.

Update Everything
Updates all plugins, themes, and WordPress core if needed.