WordPress.org

Ready to get started?Download WordPress

Forums

Plugin could not be deleted due to an error: Could not fully remove the plugin(s (6 posts)

  1. moroshko
    Member
    Posted 1 year ago #

    Why uninstalling the following (empty) plugin results in error?

    // my-plugin/my-plugin.php
    <?php
    /*
    Plugin Name: My Plugin
    */
    
    // my-plugin/uninstall.php
    <?php

    When I click 'Delete' and then confirm, I get the following error:

    Plugin could not be deleted due to an error: Could not fully remove the plugin(s) my-plugin/my-plugin.php.

    What's wrong here?

    ---

    ~/Sites/wordpress/wp-content/plugins/my-plugin $ ls -ll
    total 16
    -rwxrwxrwx@ 1 me  staff  34 13 Aug 21:43 my-plugin.php
    -rwxrwxrwx@ 1 me  staff   6 13 Aug 21:44 uninstall.php
  2. s_ha_dum
    Member
    Posted 1 year ago #

    1) You have a PHP comment (Line #1) outside of your PHP tags, which is wrong but probably won't cause this error. It will cause other problems though.

    2) You have nested PHP opening tags. That is, you have a second PHP opening tag on line 8 but haven't closed the tag you opened on line 2. That is invalid. PHP will try to execute that tag as if it were PHP code, which it isn't.

  3. moroshko
    Member
    Posted 1 year ago #

    Sorry, I meant that "my-plugin/my-plugin.php" looks like:

    <?php
    /*
    Plugin Name: My Plugin
    */

    and "my-plugin/uninstall.php" looks like:

    <?php

    i.e. there is no PHP comment before <?php, and there is no nested <?php tags. Note also that the closing ?> is optional (and not recommended).

    Any other ideas?

  4. s_ha_dum
    Member
    Posted 1 year ago #

    What are the permissions on your plugin directory?

  5. moroshko
    Member
    Posted 1 year ago #

    Plugin's directory permissions are: drwxr-xr-x

  6. s_ha_dum
    Member
    Posted 1 year ago #

    That is interesting. I assume that you using the built in functions to try to delete? Will other plugins delete or is it just this one that won't?

    I have a clean 3.4.1 install. I will recreate your minimal plugin and see what happens.

Topic Closed

This topic has been closed to new replies.

About this Topic