How to Repair a Broken Add Media Button in WordPress

Is your Add Media button not working on your website? The Add Media button allows you to insert media items like images, GIFs, and videos directly into your WordPress content. Unfortunately, this common WordPress error does not give you any hints to what causes it, which can leave beginners very frustrated. Luckily, it is very easy to fix.

Like all WordPress errors, you will need to find out what is causing the issue to be able to fix it. The main issues are usually custom scripts not working correctly, plugins, or themes. Today, I will demonstrate how to repair a broken Add Media button by showing you how to detect the problem.

What Causes the Add Media Button to Stop Working

The main cause of this error are scripts misbehaving. These can be custom scripts, plugins, or even themes. You may be wondering how exactly a theme is producing a script and the answer is simple, premium themes. Many premium themes are adding built-in plugins to the theme. These built-in plugins can create scripts as well, which can lead to this error.

To look a little deeper at how WordPress works and what exactly causes this error, the system tries to load all scripts and stylesheets together. This means that it will combine requests to get the job done as fast as possible. The post editor runs in JavaScript and if there is a conflict when WordPress is loading all of the scripts and stylesheets, it will not work. That is when the Add Media button stops working and the error presents itself.

How to Repair a Broken Add Media Button in WordPress

Today, I will demonstrate how to repair a broken Add Media button by showing you how to detect the problem. I will show you a short-term solution and how to track the problem to fix it in the long run. You will not need any additional plugins, but you will need access to your website’s cPanel. The login information is provided to you by your web host when you create an account.

Short-Term Solution

Using this method will get everything working again, but it will not fix the core problem of the error. This method will simply add a line of code to your wp-config.php file that will tell WordPress to load one request at a time. This will most likely slow down your website if you have a lot of scripts running, but you will be able to use the Add Media button again. This is only a short-term solution and you will still need to find the problem script on your website.

Let’s start by logging into the cPanel and clicking on the File Manager option. The File Manager will allow you to access all of the files related to your website.

Click on the File Manager option.

You need to locate your wp-config.php file. Click on the public_html directory. Right-click on the wp-config.php file and select the Edit option.

Select the Edit option.

A pop-up window will show up. This box will warn you to create a backup of your files before editing anything. This will ensure that you can revert your website back to when it was working if something goes wrong. Click on the “Edit” button. A new tab will open containing all of the code from the file.

Click on the "Edit" button.

Scroll down to the bottom of the file and above the “/* That’s all, stop editing! Happy blogging. */” line, copy and paste the following line:[ht_message mstyle=”info” title=”” show_icon=”” id=”” class=”” style=”” ]define(‘CONCATENATE_SCRIPTS’, false );[/ht_message]

This code makes your website load one script at a time. This should fix any conflicting scripts from causing problems. Once you have inserted the code into the wp-config.php file, click on the “Save Changes” button to finish.

Click on the "Save Changes" button.

Your Add Media button should now be working, but don’t relax yet, you need to find the script that is causing the issue.

Checking Your Website

Before continuing it is important to note that you must undo the short-term solution to properly track down the cause of the problem.

The very first thing you should check is any custom scripts you have added to your website. They are the most probable cause of a conflict in WordPress. Every custom script is unique and many websites use different plugins and themes so it is hard to track which script is conflicting with another. It is different for every website. Try disabling them and see if the problem is resolved. If it is, you need to find out why the script is causing a conflict.

If custom scripts did not cause the error, the next most likely issue is plugins. You need to deactivate each of your plugins, one by one, and check to see if the error is fixed. If it is, that plugin is responsible and should be deleted. You should also take the time to contact the plugin’s developer so they are aware of the issue.

The last thing to check, which is also the easiest to check, is your theme. Change your theme to another theme. I recommend the default WordPress theme, but as long as it is one that does not have any built-in plugins, it should work fine.

This process may take some time, but as long as you are thorough, you should be able to find the problem.

What was causing your Add Media button to stop working? How long did it take you to fix it?

1 thought on “How to Repair a Broken Add Media Button in WordPress”

  1. Hi… so a clients site has the Add Media button issue and I have found it is the theme.. unfortunately I built the theme with a now defunct tool called Artisteer… Where do I start figuring out what to do in this theme
    Thanks!
    Steve

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.