• I keep finding conflicting ways to write an uninstall.php file for your plugin. I know how to delete_options, I’m just not sure If the beginning of my uninstall.php is correct. I’ve found two articles that say to do it differently:

    Codex:

    //if uninstall not called from WordPress exit
    if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
    	exit ();
    
    delete_option('example');

    and alternate source (wptuts):

    if(defined('WP_UNINSTALL_PLUGIN') ){  
    
      //delete options, tables or anything else  
    
    }

    So which is the correct way? I’m leaning towards the wptuts way, but only because it seems to make a bit more sense to me.
    Thanks guys

Viewing 1 replies (of 1 total)
  • I prefer the second way if there is not much code. But I prefer the first way if there is a lot of code, because I do not like { and } to be far apart.

Viewing 1 replies (of 1 total)
  • The topic ‘Uninstall.php for my plugin’ is closed to new replies.