How to Fix “Are You Sure You Want to Do This” Error in WordPress
Every once in a while, you might encounter a WordPress error like error establishing database connection or memory exhausted error. These errors are somewhat helpful because they tell you exactly what the problem is.
On the other hand, there are unhelpful errors like “Are you sure you want to do this”.
There are too many factors that can lead to this error. This is why WordPress is unable to provide any information to point you in the right direction to fix it.
What causes the: “Are you sure you want to do this?” error?
‘Are you sure you want to do this?’ error usually appears when nonce verification fails and the most likely candidates to cause this error are plugins and themes not using this feature properly.
Nonces are unique keys which add a security layer to protect WordPress URLs, forms, and ajax calls from abuse. They ensure that a script is originating from your website and not an external source like a hacker trying to gain access to your website.
How to Fix “Are You Sure You Want to Do This?” Error
Most commonly, this error is caused by a plugin or theme that is installed on your site. To investigate which plugin or theme is causing the issue, you will need to deactivate all your plugins.
First, you need to deactivate all WordPress plugins and make sure that WordPress is unable to locate any installed plugin.
Simply connect to your WordPress hosting account using an FTP client.
Once connected, go to the wp-content folder and rename plugins folder to plugins.deactivated.
After that, you need to go back to the plugins page in your WordPress admin area. You will see a notification for all your plugins which are now deactivated.
Now that all your plugins are properly uninstalled and deactivated, you can try to reproduce the error.
If the error does not appear again, then this means that one of the plugins on your website was causing the issue. To figure out which plugin was causing the issue, go back to your FTP client and rename plugins. deactivated folder back to plugins.
After that, visit the plugins page in your WordPress admin area and activate each plugin one by one. You need to try to reproduce the error after activating each plugin until you find the plugin that is causing the issue.
Yes, this sounds like a time-consuming task, but it is the easiest way for beginners to find a misbehaving WordPress plugin.
If the plugins were not causing this issue, then it might be your theme that is causing the ‘Are you sure you want to do this’ error.
You can investigate the theme causing this issue by repeating the same procedure you did for plugins. First, you need to connect to your website using an FTP client and download your currently active theme to your computer as a backup.
Once you have backed up your theme, you can safely delete it from your web server.
Now visit Appearance » Themes page in your WordPress admin area, and you will see a notification. ‘The active theme is broken. Reverting to the default theme’.
WordPress will now start using the default theme like Twenty Seventeen for your website.
If you are unable to reproduce the error after the default theme was activated, then this means that your theme was causing ‘Are you sure you want to do this?’ error.
Unable to Find The Source of The Error
Make sure that you have tested thoroughly to reproduce this error after deactivating and reactivating your plugins and themes.
If you find out that no plugin or theme on your site is causing the error, then there are a few extra steps you can take.
These steps will basically replace all core WordPress files with fresh copies downloaded from the source.
First, you need to make a complete WordPress backup for your site. This step is important as it will help you easily restore your website in case something goes wrong.
Next, connect to your website using an FTP client and download the ‘wp-config.php’ file to your computer. This file contains your WordPress database settings which you will need later.
After that, you need to carefully delete all WordPress files from your server except wp-content folder and all its contents.
After that, you need to download a fresh copy of WordPress to your computer. You can download it from WordPress.org website as a zip file.
Go ahead and extract the zip file on your computer and upload the files inside the ‘wordpress’ folder to your web server using FTP.
Once you have uploaded all the files, rename the wp-config-sample.php file to wp-config.php.
Now, you need to edit the new wp-config file to enter your WordPress database and table information. You can look at the old wp-config.php file that you downloaded earlier to enter all the information.
You need to add all sections except ‘Authentication Unique Keys and Salts’. Delete all the lines starting with defined in this section.
Now, save and upload your wp-config.php file back to your website.
That’s all, you have successfully refreshed your WordPress installation. You can now go ahead and try to reproduce the error on your website.