Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm planing to create a plugin called Goodbye Dolly. Once installed, it will take care for the installation to remove the auto-installing Hello Dolly (Wordpress Plugin) shipping with wordpress.

This is due to popular request. Some folks have asked for it.

I like the idea. I never cared so far because I removed it manually. But I like the idea to save the hassles and have this removal automated for the future.

I wanted to just delete the file when it exists basically. But I'm unsure a bit about file system abstraction. And I would like to do this on install / update already, so this does not needs to be checked for all the time.

So which hooks are to be considered? Any best practice ideas?

Update:

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

While I appreciate the idea, isn't this just replacing one plugin with another? Rarst's link already has the answer -- it just needs to be reworked a bit to check for the plugin periodically, like so:

function goodbye_dolly() {
    if (file_exists(WP_PLUGIN_DIR.'/hello.php')) {
        require_once(ABSPATH.'wp-admin/includes/plugin.php');
        require_once(ABSPATH.'wp-admin/includes/file.php');
        delete_plugins(array('hello.php'));
    }
}

add_action('admin_init','goodbye_dolly');

Slap that into your functions.php file (in a child theme if you aren't already using a custom theme) and you should be good to go.

share|improve this answer
1  
This code should run on upgrade only to save resources. –  toscho Mar 25 '11 at 5:16
add comment

There is the plugin Unwanted Plugins Remover now. It will remove the plugins Akismet and Hello Dolly on every upgrade. You can filter the plugin list to match only one of those plugins or to add more.

From the code:

$this->unwanted_plugins = apply_filters( 
    'unwanted_plugins_list', array( 'akismet/akismet.php', 'hello.php' ) 
);
share|improve this answer
    
Thanks for the hint! –  hakre Mar 25 '11 at 12:35
add comment

Mike had covered killing Dolly in one of his answers, but that was written for initial install script.

I've tried to follow code that upgrades core to find a fitting hook, but that is quite a maze with some upgrader classes I am not acquainted with yet.

share|improve this answer
    
Okay that's at least an entry into the topic. I'll check your link. –  hakre Dec 25 '10 at 20:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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