Finding a faulty plugin

Issue

A WordPress site with 50+ active plugin was breaking WP-CLI.

All wp commands were returning empty.

Solution

As many plugins were not standard, we tried skipping all plugins first.

wp --skip-plugins post list

Above worked! ?

Next…

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.

TODO: 

  1. Add a codeception example
  2. Add a phpunit example