• 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
Viewing 5 replies - 1 through 5 (of 5 total)
  • 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.

    Thread Starter moroshko

    (@moroshko)

    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?

    What are the permissions on your plugin directory?

    Thread Starter moroshko

    (@moroshko)

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

    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Plugin could not be deleted due to an error: Could not fully remove the plugin(s’ is closed to new replies.