How to fix the “Are you sure you want to do this” error in WordPress

When working with some WordPress plugins or themes in the admin dashboard, you may try to change a setting and receive an error message stating “Are you sure you want to do this? Please try again.

Error message

The error is presented when WordPress detects an access issue – usually due to a bug in the plugin or theme code.

Back up your WordPress installation

Before you begin troubleshooting, it’s a great idea to back up your WordPress installation fully. We will not be making any changes to the database, so there’s no need to make a copy of it. But do back up the folder on your server that contains the core WordPress files, your theme files, plugins and media.

Log in to your HostPapa Dashboard and in the top navigation menu, select My cPanel.

My cPanel Menu

Now select File Manager.

cPanel

In File Manager, use the +Folder command at the top of the screen to create a backup folder for your files. Enter a folder name, then click Create New Folder to proceed.

Create folder

Navigate to your WordPress folder and right click on it. From the context menu, select Copy.

Copy command

You’ll be asked to enter a location (path) to which to copy your WordPress installation. Enter the full path to your newly created backup folder. Tip: check the File Manager sidebar for the file path.

Backup path

Click the Copy File(s) button to back up your WordPress files and folders.

Deactivate and reactivate your plugins

To resolve the error, you must first identify the plugin (or theme) creating the issue. The simplest way to do so is to deactivate all of your plugins and then reactivate them one at a time, until the issue reoccurs.

If you still experience the issue when all of your plugins are deactivated, move on to the next step, troubleshooting your theme.

You can deactivate your plugins in one procedure using an FTP client or cPanel File Manager. Navigate to the app folder in your main WordPress folder.

cPanel File Manager

Right click on the plugins folder (which is where WordPress keeps your plugin files) and select Rename.

Rename menu

Rename the file to something like plugins.old – any name will do, as long as it’s different to the original. This step will automatically deactivate all of your plugins and you should now be able to access your WordPress admin dashboard.

Once you have logged in, go back to your /app/ folder and create a new plugins folder. Copy each plugin, one at a time, from plugins.old into the new folder. When you hit the error once again, you will have identified the problem plugin.

Revert to the default theme

If the above steps do not work, then there may be an issue with your site theme. Themes may include misbehaving code that can cause logins to fail. You can switch to a default theme, or another installed theme by editing the WordPress database.

Log in to your HostPapa Dashboard and in the top navigation menu, select My cPanel.

My cPanel Menu

Click the phpMyAdmin icon, found under Databases.

phpMyAdmin

In phpMyAdmin, select your WordPress database from the list in the left sidebar.

If you need to check your WordPress database name, you can do so from your wp-config.php file. Head back to My cPanel (or open in second browser tab) and, from the Files menu, select File Manager.

File Manager

When cPanel File Manager opens, select your WordPress directory from the left sidebar. Then, look for your wp-config.php file in the main panel.

wp-config.php

Click the file to highlight, then select View from the top toolbar.

The wp-config.php file will be opened. Look for the following lines:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'xxxxxxx_xxxxxx');

Your database name will be listed next to ‘DB_NAME‘.

Database name

Now head back to phpMyAdmin, where you’ll see a list of database tables displayed. Look for your database name and expand the list of tables. Select the table called [yourprefix]_options (in the example above, it’s wpjq_options, but your prefix will be different).

Display options

At the top of the page, click the Number of rows dropdown menu and select 500, to expose the full list of database records. When the screen updates, scroll down the list of options until you find Template and stylesheet.

Theme options

In the example above, both are set to Avada, which is the name of the theme currently active on the site. Click the Edit button for both records and enter the name of another theme you have installed on the site. Common WordPress default themes include Twenty Seventeen (enter twentyseventeen for the option_value), Twenty Sixteen (twentysixteen) and so on.

Editing records

Click the Go button to save your changes and ensure you have amended both the Template and stylesheet records.

Try to log in to your WordPress administration dashboard. If the issue is resolved, you should get in touch with the theme author to report the problem.

Reinstall WordPress

Another troubleshooting step you can take is to reinstall your core WordPress files. Be sure you have a full backup of the site, then using cPanel File Manager or an FTP client,  delete your WordPress files except the app directory and its contents.

Now download a fresh copy of WordPress, extract the files and upload to your original WordPress directory.

Create a new wp-config.php file, using the details from the backed-up version of the file on your local computer. Add your server and database details, but do not add the details under Authentication Unique Keys and Salts.

wp-config.php

Save and upload the wp-config.php file. Check your website to see if the issue reoccurs.

For more help, or to ask a question, please open a support ticket from your HostPapa Dashboard. Follow this link to learn how.

Related Articles

Get online with our affordable web hosting

Get online with our affordable web hosting

Learn more now
HostPapa Mustache