Tag - Error

How to Fix the Error Establishing a Database Connection in WordPress


Are you seeing the ‘Error establishing a database connection’ notice on your WordPress website? It is a fatal error that makes your WordPress website inaccessible to the users.

This error occurs when WordPress is unable to make a connection to the database. A number of things can affect your WordPress database connection which makes it a bit difficult for beginners to troubleshoot.

In this article, we will show you how to easily fix the error establishing a database connection in WordPress.

Fixing the database connection error in WordPress

What Causes Error Establishing a Database Connection in WordPress?

The ‘Error establishing a database connection’ issue can be caused by incorrect database information in your WordPress settings, corrupt database, or an irresponsive database server.

Database connection error in WordPress

A database is a software which makes it easy to store, organize, and retrieve data into other software.

As a content management system, WordPress uses a database to store all your content and other website data. It then connects to the database each time someone visits your website.

WordPress needs the following information for connecting to the database:

  • Database name
  • Database username
  • Database password
  • Database server

This information is stored in your WordPress configuration file called wp-config.php.

If any of these items are incorrect, WordPress would fail to connect to your database server, and you’ll see the ‘Error establishing a database connection’ error.

It is one of the most common WordPress errors. Apart from incorrect credentials, this error can also appear if the database server is down, or the database files are corrupt.

Let’s take a look at how to fix error establishing database connection issue in WordPress with step by step troubleshooting.

1. Check Your WordPress Database Credentials

The most common reason for database connection error in WordPress is incorrect database credentials. If you have recently moved your WordPress site to a new host, then this could be the most likely reason.

Your WordPress database credentials are stored in the wp-config.php file. It is the WordPress configuration file that contains important WordPress settings including database information.

If you have not edited wp-config.php file before, then take a look at our guide on how to edit wp-config.php file in WordPress.

You’ll be looking for the following lines in the wp-config.php file.


// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

You need to make sure that the information for the database name, username, password, and database host is correct.

You can confirm this information from your WordPress hosting account dashboard. Simply log in to your hosting account and click on MySQL databases under the database section.

Database information

This will take you to the database management page in your hosting dashboad. From here, you can find out your database name and the username.

Database name and username

Below that you will find the database users and links to change the user password.

Changing database user password

Once you have confirmed your database name, username, and password, you can change that information in your wp-config.php file if needed.

After that, try visiting your website again to see if the database connection error has gone.

If you can still see the error, then this means that something else is wrong. Continue reading for more troubleshooting steps.

2. Check Your Database Host Information

If you are confident that your database name, username, and password information is correct, then you may want to make sure that you are using the correct database host information.

Most WordPress hosting companies use localhost as your database host. However, some managed WordPress hosting companies use separate servers to host databases. In that case, your database host information will not be localhost.

You need to contact your WordPress hosting company to confirm your database host information.

3. Repair WordPress Database

If you are getting a different error on the wp-admin, for instance, something like “One or more database tables are unavailable. The database may need to be repaired”, then you need to repair your database.

You can do this by adding the following line in your wp-config.php file. Make sure to add it just before ‘That’s all, stop editing! Happy blogging’ line wp-config.php.

define('WP_ALLOW_REPAIR', true);

Once you have done that, you can see the settings by visiting this page: http://www.yoursite.com/wp-admin/maint/repair.php

Repair WordPress database

Note: the user does not need to be logged in to access the database repair page. Once you are done repairing and optimizing your database, make sure to remove this code from your wp-config.php.

4. Check if Your Database Server is Down

If everything seems to be correct, and WordPress still cannot connect to the database, then your database server (MySQL server) may be down.

This could happen due to heavy traffic on a server. Basically, your host server just cannot handle the load (especially when you are on shared hosting).

Your site will get really slow and for some users it may even output the error. So the best thing you should do is get on the phone or live chat with your hosting provider and ask them if your MySQL server is responsive.

If you have other websites running on the same server, then you can check those sites to confirm that your SQL server is down.

If you do not have any other site on the same hosting account, then simply go to your hosting dashboard and try to access phpMyAdmin and connect the database.

If you can connect, then we need to verify if your database user has sufficient permission. Create a new file called testconnection.php and paste the following code in it:

<?php
$link = mysqli_connect('localhost', 'username', 'password');
if (!$link) 
die('Could not connect: ' . mysqli_error());

echo 'Connected successfully';
mysqli_close($link);
?>

Make sure to replace the username and password. You can now upload this file to your website and access it via web browser.

If the script connected successfully, then it means that your user has sufficient permission, and there is something else that is wrong.

Go back to your wp-config file to make sure that everything there is correct (re-scan for typos).

Other Solutions That Have Worked for Users

If the above-mentioned troubleshooting tips failed to fix the database connection error on your website, then you may try these additional steps.

Reported by our users, these steps have helped some users resolve the database connection error on their websites.

1. Update WordPress Site URL

Try updating the WordPress site URL using phpMyAdmin. Simply access phpMyAdmin from your hosting account dashboard, and select your WordPress database.

Running SQL in phpMyAdmin

After that click on the SQL menu on the top and enter the following MySQL query.

UPDATE wp_options SET option_value='YOUR_SITE_URL' WHERE option_name='siteurl'

Don’t forget to provide your own site URL and change wp_options to your own table name as you may have changed the WordPress table prefix.

2. Rebooting Web Server

Users on dedicated servers, local server, and virtual private servers (VPS) can try rebooting their servers.

This will restart your web and database server which may fix some temporary glitches causing the error.

3. Ask for help

If everything else fails, then you may need to contact your web hosting company. All good WordPress hosting companies will help you troubleshoot the problem, point you in the right direction, or even fix it for you.

You can also hire WordPress developers from Codeable that can help you fix this issue for reasonable rates. The best part is that these developers are highly-vetted by Codeable team, so you know they can be trusted.

We hope this article helped you fix the error establishing a database connection in WordPress. You may also want to see our WordPress troubleshooting guide for tips on resolving WordPress issues on your own.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Fix the Error Establishing a Database Connection in WordPress appeared first on WPBeginner.



Source link

How to Fix Your Connection is Not Private Error (Site Owners Guide)


Are you seeing ‘Your connection is not private’ error on your WordPress website? This is the error message you’ll see on Google Chrome.

The same error will be displayed on all modern browsers with slightly different messages, and it can be a bit confusing for beginners to troubleshoot.

In this site owner’s guide, we’ll show you how to easily fix ‘Your connection is not private’ error on your website. We’ll also talk about why this error appears, and how you can avoid it in the future.

Fixing your connection is not private error in WordPress

What is ‘Your Connection is Not Private’ Error?

‘Your connection is not private’ error appears on websites using the SSL / HTTPs protocol when your browser is unable to validate the SSL certificate issued by the website.

Basically, any website using SSL / HTTPs protocol sends a security certificate information to users browsers upon each visit. Browsers then try to validate the certificate using the public key accompanying the certificate.

If it checks out, then users browser encrypts the data using the private key sent by your website. This encryption secures the data transfer between a user’s browser and your website.

How SSL works to protect data transfer

However, if the browser is unable to validate the certificate, then it cannot transfer the data securely and displays the error that your connection to the website is not private.

This is a common SSL error and appears on all modern browsers with slightly different error messages.

Google Chrome

Google Chrome will show this error as ‘Your connection is not private’.

Your connection is not private error in Google Chrome

Mozilla Firefox

Firefox would show this error as ‘Your connection is not secure’.

Connection not secure error in Google Chrome

Microsoft Edge

Microsoft Edge browser displays it with the ‘Your connection isn’t private’ or ‘This site isn’t secure’ error message.

This site is not secure - Microsoft Edge

Safari, Brave, and other browsers will display similar messages.

Why This Error Message Occurs?

Now you may be wondering, what caused ‘Your connection is not private’ error to appear on your website. This error is peculiar because in many cases it may show up without you making any changes to your website.

It can be caused by several reasons. For instance, if a user’s computer clock is out of sync, then it may show the certificate as expired.

Another scenario is that a certificate previously issued by your website is stored in user’s browser. The private key sent by your website does not match the old certificate and the browser fails to validate the secure connection.

Last but not least, the most obvious reason you’d see this error is if the SSL certificate on the website has expired.

The following are the steps you can take to fix the ‘Your connection is not private’ error. You can also try these steps even when the error is appearing on other websites as well.

1. Force Reload a Page

Reload a page

The first step is to try turning it on and off method. Start by simply shutting down the browser app and then reopening it.

After that, try to visit the website. If you can still see the error then try force reloading the page. Use Command + R keyboard shortcut on Mac or CTRL + Reload button on Windows.

This will force the browser to ignore the cached version of the page and load the latest version.

2. Check with Multiple Browsers

Test in multiple browsers

If you are only checking it with one browser on the same machine, then try visiting the website using any other browser app.

This step will eliminate the possibility that the issue is limited to a specific browser. If it is, then reinstalling that browser would fix the issue.

Otherwise, you can move on to try the next steps in this guide.

3. Clear Your Browser Cache

Clear your browser cache

You may have heard this as the first advice for many internet and website-related issues. It is true in this case too. Your browser may be loading files from an older version of your website which may be triggering the issue.

We have a complete guide on how to clear browser cache for all major browsers with step by step instructions.

Once you have cleared the cache, try visiting the website again to see if the issue has resolved. If it hasn’t, then continue reading.

4. Check Your Computer’s Clock

Normally, your computer syncs its date and time settings automatically. However, if your computer has incorrect date/time settings, then this may cause your browser to think that a website’s SSL certificate is invalid.

Sync Date / Time on Windows Computers

If you are using a Windows computer, then simply right click on the taskbar and select ‘Adjust Date and Time settings’.

Adjust date and time in Windows

This will open date and time section in the Windows Settings app. Make sure that your computer’s date and time is correct and ‘Set time automatically’ option is checked.

Date and time settings are turned on to automatically sync

Sync Date / Time on Mac Computers

If you are using a Mac computer, then open the ‘Settings’ app and click on the ‘Date & Time’ icon.

Date and time settings in Mac

Next, switch to the Date & Time tab and make sure that the option next to the ‘Set date and time automatically’ option is checked. If it is not checked, then click on the padlock icon at the bottom left corner of the window to enable this option.

Sync date and time and settings in Mac

5. Turn off Antivirus and VPN Apps

If you are using any antivirus programs on your computer or a VPN service, then you may want to temporarily turn them off.

This would allow you to verify that these apps are not blocking the SSL certificate and forcing your browser to show the ‘Your connection is not private’ error.

If you discover that one of these apps was causing the problem, then you can reach out to their support team for help.

6. Check Your SSL Certificate Expiration

Another common reason for this error is expired SSL certificates. These certificates are issued for a specific period and expire when they reach the end of that period.

You can check your certificate’s expiration date by clicking on the padlock icon next to your website and selecting the certificate option.

Checking a website's SSL certificate details

This will bring up your SSL certificate details. You can clearly see certificate expiration date in the window.

SSL expiry date

Most domain registrars and SSL certificate providers will automatically notify you when your SSL certificate needs to be renewed.

If you are using a free SSL certificate, then most WordPress hosting companies have scripts in place that automatically renew them upon expiration.

However, those mechanisms may fail and your SSL certificate may expire. Don’t worry, you can easily fix that by simply replacing your SSL certificate.

Instructions to do that may vary depending on your certificate provider and hosting company. In fact, many hosting companies will update it for you upon request.

7. Test Your SSL Server

SSL test tool

If you have been setting up your SSL certificate manually by yourself, then you may want to make sure that all configuration settings are working properly.

To do that you can run an SSL server test. This test allows you to check the complete SSL set up of your website.

This includes TLS protocol, cross-browser testing, and SSL/HTTPs set up checks. The scanner will also provide you detailed information about each test.

8. Check Certificate Domain Name

You can set up your SSL certificate to work for different variations of a domain name. For example, www and non-www URLs.

If your certificate is only set up for one variation of your domain name, and you access the website using another variation, then this would result in ‘Your connection is not private’ error. Google Chrome will show the error code as SSL_ERROR_BAD_CERT_DOMAIN.

This error could also appear if you have recently moved your website to a new domain name or server.

One easy solution is to issue a free SSL certificate for both variations of your domain name. You can request your hosting provider to do that for you.

Another solution is to redirect your website visitors to the correct variation of your domain name. See our article, on how to set up redirects in WordPress for more details.

We hope this article helped you learn how to fix ‘Your connection is not private’ error in WordPress. You may also want to bookmark our guide on fixing the most common WordPress errors.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.



Source link

How to Fix the 401 Error in WordPress (6 Solutions)


Are you seeing a 401 error on your WordPress site?

It is one of the most confusing WordPress errors that could lock you out of your WordPress website.

The 401 error has multiple names including Error 401 and 401 unauthorized error. These errors are sometimes accompanied by a message ‘Access is denied due to invalid credentials’ or ‘Authorization required’.

In this article, we will show you different solutions to easily fix the 401 error in WordPress. We will also discuss what causes it, and how to avoid it in the future.

Fixing the 401 error in WordPress

What Causes the 401 Error in WordPress?

The 401 error in WordPress is caused by improper authentication while communicating with the WordPress hosting server.

For example, if you have password-protected your WordPress admin folder, then not entering a password will show a 401 error page on WordPress login and admin pages.

401 Authorization failed error

However, in some cases you may see this error even without adding any special password protection to your website.

For example, WordPress security plugins can lock down your admin area during a brute force attack.

Another common cause of this error is security measures taken by hosting companies to protect your WordPress website. These security measures start showing this error when your WordPress login pages are accessed excessively.

Mostly, 401 error appears on WordPress admin and login pages. However, in some cases, it could appear on all pages of your website.

You’ll need to troubleshoot exactly what’s causing the error and then fix it.

That being said, let’s take a look at different solutions to quickly fix the 401 error in WordPress.

1. Temporarily Remove Password Protection on WordPress Admin

If you have password-protected your WordPress admin directory, then this could be the solution you need.

You may have forgotten your admin directory password, or your server configuration may have changed.

Head over to your WordPress hosting control panel and locate the Directory Privacy or Password Protected Directories icon.

Our screenshot is showing our Bluehost hosting account, but most hosting panels will have this option.

Directory privacy

Once you open it, you will see all the files and folders on your hosting account. Browse to your wp-admin directory and select it by clicking on the name.

The control panel will now display its password protection settings. Simply uncheck the box next to ‘Password protect this directory’ option and click on the Save button.

Disable password protection

After that, click on the Go Back button and scroll down to the bottom of the page. From here you need to delete the username you used to login to your password-protected directory.

You have successfully disabled password protection for your WordPress admin directory. You can now try to log into your WordPress site.

If everything works normally, then you can go ahead and enable password protection for your WordPress admin area by creating a new user and password.

2. Clear Firewall Cache to Solve 401 Error in WordPress

If you are using a cloud-based WordPress firewall service like Sucuri or Cloudflare, then 401 error may be triggered when the firewall fails to communicate with your website.

Purge Cache in Sucuri Firewall

If you are using Sucuri, then login to your Sucuri dashboard and visit the ‘Performance’ page. From here you need to switch to the ‘Clear Cache’ tab and then click on the ‘Clear cache’ button.

Sucuri clear cache

Purge Cache in Cloudflare

If you are using Cloudflare, then you need to login to Cloudflare dashboard and go to the ‘Caching’ section. From here you need to click on the ‘Purge everything’ button to clear all cache.

Cloudflare clear cache

After clearing your firewall cache, go ahead and clear your browser cache or WordPress cache as well. See our complete guide on how to clear cache in WordPress for more details.

3. Deactivate All WordPress Plugins

A misbehaving or poorly configured WordPress plugin can also trigger the 401 error. You will need to temporarily deactivate all WordPress plugins to find out if the error is caused by one of them.

You can simply deactivate WordPress plugins from inside the admin area by visiting the plugins page.

Deactivate all plugins

However, if you cannot access the WordPress admin area, then you’ll need to use FTP to deactivate all WordPress plugins.

Simply connect to your WordPress site using an FTP client. Once connected go to /wp-content/ folder and rename the plugins folder to plugins.deactivated.

Deactivate all WordPress plugins via FTP

Renaming the plugins folder will deactivate all WordPress plugins.

You can now visit your WordPress website’s admin area and try to log in. If everything works fine, then this means that one of the plugins was causing the issue.

Now you need to switch back to FTP client and once again rename the plugin’s folder to just plugins.

Next, return to the WordPress admin area and go to the plugins page. You can now activate each plugin one at a time until you start seeing the 401 error again.

This will help you find the plugin causing the issue. Once you found the plugin, you can contact plugin’s support or find an alternative plugin.

4. Switch to a Default WordPress Theme

Sometimes a function inside your WordPress theme may trigger the 401 error on your website. To find out, you need to temporarily switch to a default WordPress theme.

Default themes are made by the WordPress team and are shipped with the default WordPress install. These themes include Twenty Nineteen, Twenty Seventeen, Twenty Sixteen, and more.

First, go to Appearance » Themes page. Now if you have a default WordPress theme installed, then you can go ahead and activate it.

Activate default WordPress theme

If you don’t have a default theme installed on your site, then you need to install and activate it. See our guide on how to install a WordPress theme for instructions.

After switching the theme, you can go and test your website. If everything works OK now, then this means your theme was causing the 401 error.

You can report the issue to the theme developer, they may be able to help you fix it. If that doesn’t work, then you can permanently change your WordPress theme.

5. Reset WordPress Password

WordPress hosting companies can sometimes block access to wp-admin and login pages if someone is repeatedly trying to enter a password.

In that case, your access will be temporarily blocked, and you can try after a few minutes.

However, instead of guessing your password it would be best to recover forgotten WordPress password.

Lost password

WordPress will send you an email with a link to change your password. The problem with this method is that sometimes WordPress may fail to send emails.

If you don’t get the email, then don’t worry. You can also reset the WordPress password using phpMyAdmin.

6. Contact WordPress Hosting Provider

Many WordPress hosting companies automatically detect suspicious activity on a WordPress website and block access to prevent attacks.

These security precautions sometimes only affect the WordPress admin area, and your login page may become inaccessible for a while.

Too many login attempts

However, if it does not return back to a normal state, or you are seeing 401 error on all your site pages, then you need to contact your WordPress hosting provider immediately.

Their staff will be able to check the access and error logs to fix the issue for you.

For future prevention, you can follow our complete WordPress security guide to protect your WordPress admin area from unauthorized access.

We hope one of these solutions helped you fix the 401 error in WordPress. You may also want to see our complete WordPress troubleshooting guide with step by step instructions to fix common WordPress issues by yourself.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Fix the 401 Error in WordPress (6 Solutions) appeared first on WPBeginner.



Source link

How To Fix “The Link You Followed Has Expired” Error in WordPress


Are you seeing ‘The link you followed has expired’ error in WordPress?

This error does not give much clues about what’s actually wrong, which is why beginners find it a bit difficult to resolve.

In this article, we will show you how to easily fix ‘the link you have followed has expired’ error in WordPress. We will also talk about what causes this error and how to avoid it in the future.

Fixing 'The link you have followed has expired' error

What Causes The Link You Have Followed Has Expired Error?

This error usually occurs when you are trying to upload a WordPress theme or a plugin to your website from the WordPress admin area.

The link you followed has expired error displayed on a WordPress website

WordPress hosting companies have a setting which controls the size of files you can upload from inside the WordPress admin area. They also have a setting which stops scripts from running too long.

You can see the file size upload limit by visiting Media » Add New page.

WordPress file upload limit

These restrictions make your website safer and improves the overall performance of your WordPress hosting server.

If these settings are too low, or you are trying to upload a larger file, then you would see errors like memory exhausted error or maximum execution time exceeded error.

However, if you are trying to upload a WordPress theme or plugin, then you would see ‘The link you followed has expired’ error.

That being said, let’s take a look at how to easily fix this problem.

Fixing ‘The Link You Have Followed Has Expired’ Error

The quickest way to fix ‘The link you followed has expired’ error is by increasing the file upload size, PHP memory, and execution time limits for your website.

There are multiple ways to do that. We will show you all of them, and you can choose the one that looks easier or the one that works on your hosting environment.

Method 1. Increasing limits in functions.php file

This method is easier, but it has a downside. Your site will return back to the old limits if you change WordPress theme. If you are planning on changing your theme, then try one of the other two methods described below.

Simply add the following code to your WordPress theme’s functions.php file.


@ini_set( 'upload_max_size' , '120M' );
@ini_set( 'post_max_size', '120M');
@ini_set( 'max_execution_time', '300' );

You can increase the values in upload_max_size and post_max_size to be more than the file you are trying to upload.

You will also need to increase the max_execution_time to the time you think it would take for the file to upload. If you are unsure, then you can try doubling this value.

Method 2. Fix by increasing limits in .htaccess file

If you don’t want to add code to your theme’s functions file, then you can try the .htaccess method.

For this method, you will need to edit the .htaccess file by using an FTP client or the File Manager app in cPanel.

Simply connect to your website using FTP and edit the .htaccess file.

Editing the .htaccess file using FTP

Now, you need to add the following code at the bottom of your .htaccess file.


php_value upload_max_filesize 128M
php_value post_max_size 128M
php_value max_execution_time 300
php_value max_input_time 300

Don’t forget to save your changes and upload the file back to your website.

Method 3. Fix by increasing limits in php.ini file

The php.ini file is a configuration file used by PHP and WordPress. You’ need to connect to your WordPress site using an FTP client and look for php.ini file in your site’s root folder.

Most users are on a shared hosting account, so they may not find it in their site’s root folder. In that case, you need to create a blank php.ini file using a plain text editor like Notepad and upload it to your website.

Now edit the php.ini file and add the following code inside it.


upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 300

Don’t forget to save your changes and upload the file back to your website.

You can now visit your website and try to upload the theme or plugin file. The error would disappear, and you should be able to upload the file.

If it doesn’t, then try to increase file limits to match the file size you are trying to upload.

We hope this article helped you easily fix ‘The link you followed has expired’ error in WordPress. You may also want to bookmark our guide on how to fix the most common WordPress errors. It will help you save a lot of time by quickly finding a fix for WordPress issues.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.



Source link

How To Fix “Failed To Load Resource” Error In WordPress


Are you seeing “Failed to load resource error” in WordPress or your browser’s inspect tool?

Many WordPress users find it difficult to figure out what resource or file is not loading, and more importantly why is it not loading correctly.

This file can be anything like an image, other media, JavaScript, or a CSS stylesheet. A missing resource can cause your website to misbehave or not function properly.

In this article, we will show you how to easily troubleshoot and fix the “Failed to Load Resource” error in WordPress.

Fixing the failed to load resource error in WordPress

Why Failed to Load Resource Error Occurs?

Failed to load resource error occurs when WordPress is unable to load a file that it is supposed to load.

Basically when WordPress generates a page, it includes several files in the code such as images, scripts, stylesheets, and more. During the page load, these files are loaded by user’s browser.

For more details, see our guide on how WordPress works behind the scenes.

If the browser is unable to load a specific file, then it would go on to display the page without that file. Further, the browser will add a notice in the error console for debugging purposes.

In most cases, you would see this error in your browser’s error console when using the Inspect tool.

Failed to load resource error

This resource could be any file like an image, JavaScript, CSS stylesheet, etc. The error may have different helpful messages next to them.

Below are few examples:

  • Failed to load resource net::ERR_CONNECTION_REFUSED
  • Failed to load resource: the server responded with a status of 404 (Not Found)
  • Failed to load resource: the server responded with a status of 500 (Internal Server Error)
  • Failed to load resource: net::err_name_not_resolved

Even if a specific file didn’t load, the rest of your web page will continue to load. It just may not look or behave as expected. This is why you need to fix the error to avoid any unexpected issues.

That being said, let’s see how to easily fix the failed to load resource error in WordPress.

Fixing Failed to Load Resource Error in WordPress

As we mentioned earlier, the error is caused when your website’s code mentions a file but the browser is unable to download it.

This could happen for a number of reasons. We will try to look at and eliminate them one by one.

Replace The Missing Resource

First, let’s start with the most common solution. Make sure that the failed resource actually exists.

If the missing resource is an image in one of your blog posts or page, then try to look for it in the media library.

Replace missing image

If you can see it in the media library, then try to add it again by editing the post or page. If you cannot see the file in the media library, then try uploading it again.

In some cases, you may see broken images or empty boxes in the media library instead of images. In that case, you may need to fix the file permissions. For detailed instructions, see our tutorial on how to fix image upload issues in WordPress.

Replace theme or plugin files

If the failed resource is a WordPress plugin or theme file, then the easiest way to replace it is by reinstalling the plugin or theme.

First, you need to deactivate your current WordPress theme. You can do that by visiting Appearance » Themes page.

Deactivate a WordPress theme

If you have another theme installed on your website, then you can just go ahead and activate that. This will deactivate your current theme. In case you don’t have any other theme installed, then you need to install a default theme.

Once you activate the other theme, you can visit your website to see the error has been resolved.

If the missing resource is a WordPress plugin file, then you will need to reinstall the plugin. For more details, see our step by step guide on how to install a WordPress plugin.

You can also use FTP to connect to your WordPress hosting account and manually replace a specific file. For more details, see our guide on how to use FTP.

Fixing the WordPress URL to Avoid Failed Resource Error

The most common reason that cause the failed resource error is incorrect WordPress URL settings.

Simply head over to Settings » General page and look for WordPress Address and Site Address options.

WordPress URL settings

You need to make sure that both URL are correct. You need to have the same URLs for both options.

Keep in mind that WordPress treats www and non-www URLs as two different addresses. If you have SSL enabled on your website, then your URLs should begin with https instead of http.

Don’t forget to click on the Save changes button to store your settings.

You can now visit your website to see if the error has been resolved.

If the error still persists, then you need to follow our complete WordPress troubleshooting guide. It will help you find out what’s causing the issue and how to fix it.

We hope this article helped you learn how to easily fix the “Failed to load resource” error in WordPress. You may also want to bookmark our ultimate guide on fixing the most common WordPress errors.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How To Fix “Failed To Load Resource” Error In WordPress appeared first on WPBeginner.



Source link

How to Fix Briefly Unavailable for Scheduled Maintenance Error in WordPress


Are you seeing the ‘Briefly unavailable for scheduled maintenance’ error in WordPress? This error usually appears while updating WordPress core, plugins, or themes.

Basically, your WordPress site fails to finish the update which leaves you stuck in the maintenance mode.

In this article, we will show you how to easily fix the “Briefly unavailable for scheduled maintenance” error in WordPress. We will also show you why this error occurs and how you can avoid it in the future.

Fixing unavailable for scheduled maintenance error in WordPress

Why Does The WordPress Maintenance Mode Error Occur?

Maintenance mode page is technically not an error. It is a notification page.

During the update process, WordPress downloads necessary update files to your server, extract them and then install the update.

WordPress also puts your site on maintenance mode and displays the “Briefly unavailable for scheduled maintenance. Check back in a minute.” notice during the process.

Unavailable for scheduled maintenance error in WordPress

To trigger the maintenance mode notification, WordPress creates a temporary .maintenance file in your website’s root folder.

If everything works normally, then this notice will probably be displayed for only a few seconds. After the successful update, WordPress will automatically delete the maintenance file to disable maintenance mode.

However, sometimes due to a slow WordPress hosting server response or low memory issue, the update script will timeout thus interrupting the process. When this happens, WordPress does not get a chance to take your site out of maintenance mode.

In other words, your site will continue showing the maintenance mode notice, and you will need to manually fix it.

How to Fix WordPress Maintenance Mode Error?

To get your website out of maintenance mode, all you really need to do is delete the .maintenance file from your site’s root folder using FTP.

Delete maintenance file

If you can’t find the .maintenance file in your WordPress root directory, then make sure you checked your FTP client to show hidden files.

In Filezilla, you can force it to show hidden files by clicking on Server » Force showing hidden files from the menu bar.

Show hidden files in FTP

Once the .maintenance file is removed, your site will come out of maintenance mode, and the error should be fixed.

If you don’t know how to use FTP, then you can also remove the files by going to the file manager in your WordPress hosting control panel, and then deleting the .maintenance file inside the file manager.

How to Avoid WordPress Maintenance Mode in the Future?

We already know that the “Briefly unavailable for scheduled maintenance” error is caused by slow server response or low memory issue on your web hosting server.

The easiest way to avoid this error is by upgrading to a higher hosting plan. We recommend going with one of these managed WordPress hosting companies that offer superior hosting performance.

If upgrading to a higher hosting plan is not an option, then we recommend doing plugin and theme updates one at a time.

Often users have a tendency of quickly clicking on the update link underneath each plugin. WordPress then staggers the update order, but even a millisecond of delay in connection could cause a conflict leading your site to be stuck in maintenance mode.

WordPress Plugin Update One at a Time

Instead of quickly clicking on the Update link, we recommend patiently updating one plugin at a time.

How to Customize Maintenance Mode Notification

An easier solution to avoid showing the default maintenance mode notification is by manually putting your WordPress site on maintenance mode before installing any updates.

The best way to do this is by installing and activating the SeedProd plugin. It is the most popular maintenance mode plugin for WordPress. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, go to Settings » Coming Soon Pro page and check the box next to ‘Enable maintenance mode’ option.

Enable maintenance mode

After that, you need to click on ‘Edit Coming Soon/Maintenance Page’ button. This will open the SeedProd theme customizer. From here you can choose a theme and then customize it to create a beautiful maintenance mode page for your website.

Select a theme for your maintenance mode page

Now, if you don’t want to manually put your website in maintenance mode every time you update, then you can create a maintenance page in WordPress without using a plugin.

Simply create a new file called maintenance.php on your desktop and paste this code inside it:

<?php
$protocol = $_SERVER["SERVER_PROTOCOL"];
if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
    $protocol = 'HTTP/1.0';
header( "$protocol 503 Service Unavailable", true, 503 );
header( 'Content-Type: text/html; charset=utf-8' );
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
    <h1>We are updating the site, please check back in 30 minutes.</h1>
</body>
</html>
<?php die(); ?>

Next, you need to upload this file to your WordPress site’s wp-content directory.

Now whenever you are updating your website, WordPress will show this page during the maintenance mode. You can use CSS to style this page anyway you want.

Custom maintenance mode notification

Troubleshooting WordPress Maintenance Mode Error

Since we have helped thousands of users fix the “Briefly unavailable for scheduled maintenance” error in WordPress, we have helped users solve several unseen issues that can come up.

Below are some additional steps you might have to take if the above solution does not work.

WordPress still stuck in maintenance mode after the update and fix above?

If this is the case, then you need to update the wp-activate.php file located in your main WordPress folder. This is the same place where you found and deleted the .maintenance file.

You will need to either open the file using your hosting company’s file manager or download it on your computer using FTP.

Next, you need to find the code: define ('WP_INSTALLING', true) and change the true to false.

So your code will look like this:

define ('WP_INSTALLING', false)

After that you need to save the changes and upload the file to your hosting server using FTP. If you’re using the hosting company’s file manager, then simply saving the file should get you out of maintenance mode.

My site is broken after I fixed the WordPress maintenance mode error. How do I fix it?

An unfinished or interrupted update may cause issues when your site comes out of maintenance mode.

If this error occurred when you were updating WordPress core software, then you will need to follow our guide to manually update WordPress using FTP.

If the error occurred when you were updating a WordPress plugin, then you will need to temporarily deactivate all WordPress plugins using FTP. This step will ensure that the corrupt plugin is disabled, and your website will come back.

Next, you will need to login to your WordPress dashboard and activate one plugin at a time, to see which plugin caused the issue. After that you need to manually install the plugin update, so it’s working properly.

We hope this article helped you fix ‘Briefly unavailable for scheduled maintenance’ error in WordPress. You may also want to bookmark our ultimate guide on fixing the most common WordPress errors.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Fix Briefly Unavailable for Scheduled Maintenance Error in WordPress appeared first on WPBeginner.



Source link

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.

In this article, we will show you how to investigate and fix “Are you sure you want to do this” error in WordPress.

Error - Are you sure you want to do this

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 Your 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.

Investigating 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.

Rename plugins folder to deactivate all plugins

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.

Plugins deactivated in WordPress
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.

Investigating Themes

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’.

Theme deactivated

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.

Download wp-config.php file to your computer

After that you need to carefully delete all WordPress files from your server except wp-content folder and all its contents.

Delete all WordPress files except wp-content folder

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.

See our article on how to edit the wp-config.php file in WordPress for detailed instructions.

You need to add all sections except ‘Authentication Unique Keys and Salts’. Delete all the lines starting with define in this section.

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the @link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define('AUTH_KEY',         '`+7nTNb<AwtbLA$L-Q7amn;~|wH)ljXv2~TpbP?mLA+M`8H|n1`/Lz-GmAQL4fB');
define('SECURE_AUTH_KEY',  '/gkAjhhJe`iwO)V-p=J<cN_ +6D=E#C7gD]c2w~OJ y}eY^,HWn&-j:a');
define('LOGGED_IN_KEY',    'PtDl2V|01oIXDpq^K,IH-8|rhT +T(ZMpuLq>UD?|W)b3gMfG~g[zr8N6}m%MZ|L');
define('NONCE_KEY',        ']Zj5i*hHlsUWKg2|>YF,X+xpd-_`I[nFmA6ZLw~;EW7g0.s5EaZCAJ=j]./5z^X~');
define('AUTH_SALT',        'e*l:hUsddFIxm1E7y-n#<a0|u- #+SsS@-#$vNz}EY4rY~-x|0_6=Q!TR=MMxUL?');
define('SECURE_AUTH_SALT', 'n]^c9nY>_}3,4)J]S sM6-MI3aB#Qk<Re^j#Lu_|x^*BhO.54aZQTtzJeCo5DWAg');
define('LOGGED_IN_SALT',   'Ba3kd1&J$~~`(|uJ0:v;w+DJ3xW}.B#R9J*r|.+V}*sTuK &8db-Mn+[boHW3{[/');
define('NONCE_SALT',       'nBv-U1qfkCZxS|13%hYdHz*s1^){.KSZWm1A^$`r!d5;EqrH:>1Xx`pwt6?**i');

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.

Basic Tips for Fixing WordPress Issues

We understand that fixing such issues can be frustrating at times. That’s why we have prepared a handy WordPress troubleshooting guide which shows you how to investigate and fix WordPress problems like a pro.

WordPress is used by millions of people. No matter what problem you come across, it is likely that thousands of other other people have faced it before you and have fixed it.

You can find a solution by simply entering the error in the Google search. For more helpful results, add wpbeginner.com at the end of your search term to find an easy step by step guide to fix it.

You can also bookmark our complete guide to common WordPress errors and how to fix them.

We hope this article helped you fix “Are You Sure You Want to Do This” Error in WordPress. You may also want to see our complete WordPress security guide to protect your website against hacking and malware.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Fix “Are You Sure You Want to Do This” Error in WordPress appeared first on WPBeginner.



Source link