brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: --skip-plugins and --skip-themes get WP-CLI working on a broken site

WP-CLI
~/tips/tip-wordpress-wpcli-skip-plugins

wp plugin list --skip-plugins --skip-themes

Lets WP-CLI run on a crashing WordPress site by not loading plugins or themes, so you can fix it.

A fatal error in a plugin can take WP-CLI down with the site. That is exactly when I need it most.

WP-CLI loads WordPress, and that includes every active plugin and the theme. If one of them crashes on load, your commands crash too. Two global flags tell WP-CLI to leave them out.

wp plugin list --skip-plugins --skip-themes
wp plugin deactivate broken-plugin --skip-plugins --skip-themes

The first line proves the rest of WordPress loads. The second turns off the guilty plugin, which the broken site could not do for itself. You can also skip a specific one only, with --skip-plugins=name, and a comma list works as well.

The docs add a detail: must-use plugins are still loaded with --skip-plugins, so a crash in one of those needs another approach, like moving the file. There is also --skip-packages for WP-CLI packages that misbehave, and --debug to show all PHP errors while you hunt.

The caveat: with plugins skipped, commands that depend on them will fail or give an incomplete picture. A WooCommerce command is not going to work without WooCommerce. Use the flags to get the site back, then drop them.

Further reading: WP-CLI configuration and global parameters, On this site: wp option list –autoload=on –format=total_bytes shows what every page load drags along, On this site: wp media regenerate –only-missing fixes images after a theme change

More WP-CLI tips wp widget list <sidebar-id> wp sidebar list wp taxonomy list --format=csv wp super-admin list wp cli check-update All WP-CLI tips (78) All topics

Link