Filed under: wp-cli
WP-CLI Tutorials
23 cases on file
WordPress from the command line: page creation, search-replace, backups, user management, diagnostics and scripting on Trellis and Bedrock.
-
Case No. — Devops Documented
A Standard wp-cli.yml for Bedrock, and a WP-CLI Command That Validates Block Pattern Files Against Gutenberg's Own Output
Two small pieces that I put in every Bedrock site root. The first is a wp-cli.yml that ends the --path=web/wp typing. The second is a WP-CLI command that che...
-
Case No. — Security Documented
Locked Out of WordPress: Create a Temporary Admin With WP-CLI Over SSH, Then Delete It
A lost admin password, a plugin that broke the login, an admin email that no longer exists: when you cannot log in but you can reach the server, WP-CLI gets ...
-
Case No. — Debugging Shipped
My Block Theme Template Changes Are Ignored: Find and Remove the Site Editor's Database Override With WP-CLI
I changed a pattern file in a block theme, flushed the cache, and the front end kept showing the old markup. Editing the template’s .html file did nothing ei...
-
Case No. — Security Documented
A Weekly and Monthly Security Routine for Trellis WordPress Sites: fail2ban, Scans, and Checking IPs Against AbuseIPDB Before You Block Them
Security on a Trellis site comes in layers, and each layer needs a little attention on a schedule. None of it takes long. What goes wrong is that nobody chec...
-
Case No. — Security Documented
Reading WordPress Malware Scan Results: Severity Levels, the False Positives You Can Ignore, and the Checks After a Compromise
A scanner that prints 86 matches is only useful if you can tell which three matter. The questions that come up every time: how urgent is a HIGH, is xmlrpc.ph...
-
Case No. — Security Documented
Two WordPress Malware Scanners and Checksum Verification: What Each One Catches, and How to Run Them on Any Host
A WordPress malware scan has to do two opposite things: be sensitive enough to catch an eval(base64_decode(...)) in a theme file, and quiet enough that you s...
-
Case No. — Development Documented
Creating WordPress Pages from Block Markup with WP-CLI on Trellis: VM First, Production Second, and the .test URLs That Follow You
Building a page in the block editor and building it from a file are different workflows, and the second is better when you want the page in version control, ...
-
Case No. — Development Documented
Changing a WordPress Domain, HTTPS or Bedrock Paths with wp search-replace, and the Other Ways to Fix Site URLs
After a migration the site loads and every link goes to the old domain, or the images 404 because the database still says /wp-content/uploads/. WordPress sto...
-
Case No. — Devops Documented
Migrating a WordPress Site from Shared Hosting to Trellis and Bedrock: The Order That Works
Moving a site from shared hosting, Plesk or cPanel onto a Trellis server running Bedrock is mostly a question of order. Each step is small. Doing them out of...
-
Case No. — Development Documented
Noindex WordPress Posts After an Expiry Date: Yoast's wpseo_robots Filter and the Site Timezone
Some posts have a shelf life. A race tip, an event preview or a limited offer is useful until the event happens, and then it is a stale page that still ranks...
-
Case No. — Development Documented
WooCommerce Product Attributes and Variations with WP-CLI on Trellis: Why Your Terms Land on the Wrong Site
Setting up a WooCommerce catalogue by hand means clicking through Products, Attributes, Configure terms, once per value. With WP-CLI you can create the attri...
-
Case No. — Performance Shipped
WordPress WebP Featured Images Without Breaking og:image: Convert Resized Copies, Keep the Original JPG
My blog posts had featured images, but the theme never showed them. I had uploaded them as JPG because the social share card (og:image) is built from that fi...
-
Case No. — Debugging Documented
WordPress Mail Not Arriving on Trellis: Two Different Failures That Look the Same (Config Reset vs Bounces)
“WordPress emails aren’t arriving” has at least two unrelated causes on a Trellis server, and they need opposite fixes. In one the mail never leaves the serv...
-
Case No. — Debugging Documented
Renamed a WordPress Multisite Subsite and WP-CLI Still Shows the Old Slug: A Site Path Is Cached Infrastructure
I renamed a subdirectory subsite on a Multisite network from /fintech/ to /kafe/. I changed the path in the database and expected that to be the end of it. I...
-
Case No. — Debugging Documented
Child Theme Activated but the Style Variation Is Gone: Global Styles Are Per Theme (and wp_insert_post Needs a User in WP-CLI)
I activated a block child theme on a multisite subsite and rebuilt its pages from the child’s patterns. The layout was right, but the colours and fonts were ...
-
Case No. — Performance Documented
Site Health Says Too Many Autoloaded Options: Find the Culprits with WP-CLI Before You Touch Anything
A client’s Site Health screen showed this warning:
-
Case No. — Devops Documented
Safe Plugin Updates on a Plesk Site: WP Toolkit's WP-CLI, an FTP Download and Batches
A client site had 20 pending updates. I had WordPress admin, a Plesk login and FTP, but no SSH. The site ran a custom theme that leans on ACF Pro and Gravity...
-
Case No. — Devops Shipped
Refreshing Three Local WordPress Sites From Production Without Leaving .com URLs Behind
Every few weeks my local copies drift from production far enough that I stop trusting them: stale content, missing uploads, a plugin version that no longer m...
-
Case No. — Devops Documented
WP-CLI One-Liner: Generate and Set a Secure Password Without the Shell History Risk
The command reads like a haiku, but it solves a problem that bites everybody at least once:
-
Case No. — Security Shipped
wp-ops malware-scan: Checking a Remote WordPress Site Without Leaving Anything Behind
Malware scanning a WordPress site you can only reach over SSH used to mean a small ritual: scp the scanner script up to /tmp, run it, and remember to delete ...
-
Case No. — Devops Documented
The Administration Email Field Doesn't Change the Administration Email
I opened Settings → General on a client site this week and found this sitting above the email field:
-
Case No. — Devops Shipped
The Seven Commands I Actually Run Every Day (And Why I Stopped Memorizing Them)
For a long time, my daily WordPress ops routine lived in shell history. Pull a database, sync some uploads, eyeball a security log, glance at a client site’s...
-
Case No. — Devops Patched
How Trellis's database-pull Playbook Works (And What We Fixed)
One of the most useful Trellis commands in day-to-day WordPress development is trellis db pull. It syncs your production (or staging) database down to local ...