A WordPress site with 50+ active plugin was breaking WP-CLI.
wp commands were returning empty.
As many plugins were not standard, we tried skipping all plugins first.
wp --skip-plugins post list
Above worked! ?
We need to skip each plugin one-by-one and till we find a faulty plugin.
Rather than doing manual work, a little bash for loop helps us automate entire thing.
for plugin in `wp --skip-plugins plugin list --status=active --field=name`; do echo "Test :: wp --skip-plugins=$plugin post list" wp --skip-plugins=$plugin post list done
When faulty plugin skipped,
wp post list returned expected output!
As long as some other plugin was getting skipped, we saw empty response.
You may use a loop like above with other wp-cli command or your test-scripts.
- Add a codeception example
- Add a phpunit example