I have developed a wordpress plugin and I need to delete the options I am creating when uninstalling. What I did is I created a file called uninstall.php and included the following code:


function WCM_Setup_Demo_on_uninstall()
//if uninstall not called from WordPress exit
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) 

$video-thumbnail1 = 'video-thumbnail1';

// For Single site
if ( !is_multisite() ) 
    delete_option( $video-thumbnail1 );

And included this in my main plugin file:

register_uninstall_hook('uninstall.php', 'WCM_Setup_Demo_on_uninstall');

This is how i'm registering the option in my main plugin file:

register_setting( 'baw-settings-group', 'video-thumbnail1' );

When I deactivated and deleted the plugin from the dashboard, the plugin gets deactivated but not deleted. When one press delete a blank white page comes up.


2 Answers 2


Blank/white page comes up probably due to wrong variable name. It should be $video_thumbnail1 instead of $video-thumbnail1. No need to use a variable when you can directly use the option video-thumbnail1.

Also deactivate and delete are two different functionalities. Please refer to the Codex for uninstallation hook.


Variable $video-thumbnail1 is defined incorrectly. You cant have - in the variable. Change it to $video_thumbnail1.

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.