How to Fix the ‘Failed to Load Resource’ Error in WordPress
If you are seeing the ‘Failed to load resource’ error in WordPress or the browser’s inspect tool then this post is for you. This is a common error and often baffles beginners. The file that fails to load can be anything from JavaScript and CSS stylesheet to images and other media. The good news is that there is a solution.
What causes the error?
The ‘failed to load resource’ error results when WordPress is not able to load a file. When generating a page WordPress loads several files including scripts, images, stylesheets and more. These files are normally loaded by the browser of the user. If the browser fails to load specific files then the error may be displayed. The browser may also add notice in the error console for the purposes of debugging.
Fixing the error
In general, the error occurs when a website’s code mentions a specific file but the browser is unable to download that file. There are several methods you can use to eliminate this error.
Replace missing resource
This is the most common solution to this error. You need to check if the missing resource really exists. If the resource is an image, search for it in the media library. If it actually exists in the media library try and add it again to the page or post. If the file is missing in the media library you will need to upload it again.
You may see empty boxes or broken images in your media library instead of images. To solve this issue you need to fix file permissions.
If the failed resource is a theme or plugin then you will have to replace it by reinstalling it. For themes you need to go to Appearance>>Themes page. Alternatively you can activate another installed theme and deactivate your current one that triggers the error. The same goes for plugins. Reinstalling plugins can help fix the error.
Fix WordPress URL
Fixing the WordPress URL can also fix the ‘failed to load resource’ error. An incorrect URL setting can cause the error. Go to settings>>General page and search for your WordPress Address and site address options. Ensure both URLs are correct. You should also note that WordPress treats www and the non-www URLs as different addresses. If you have SSL enabled your URL should start with https and not http. Save the changes after changing the URLs.
These two options should help you fix the ‘failed to load resource’ error in WordPress. However, if the issue is still there then you need to bring in an expert.