Upon performing delete_plugins() action, get_plugins() is give deleted plugin list.

For example:


Is I am doing something wrong? Any one give some insight about it.

  • Are you sure the plugin got deleted? Have you checked the plugins directory?
    – Max Yudin
    Apr 19, 2017 at 16:18
  • yes the plugin was deleted but also listed
    – Kuppuraj
    Apr 19, 2017 at 17:47

1 Answer 1


To answer your main question, you are missing one line before calling get_plugins(). Without it, the list of plugins will come from cache. You can use the following sequence:

delete_plugins( array( 'akismet/akismet.php' ) );
wp_clean_plugins_cache( false );

WARNING: it is not recommended using delete_plugins() in scripts, unless it is a part of complete procedure consisting of deactivation, uninstallation, and then deletion.

  • @Kuppuraj: it is still too early to delete plugins. Skipping phase of uninstallation, prevents plugins from cleaning up their settings and/or tables from database. Apr 20, 2017 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.