parallax background

WordPress Add Media Button Not Working and How to Fix It

What ‘WordPress Mixed Content’ Means and How to Fix It
May 19, 2021
 

Creating attractive digital content includes using media. Images, GIFs, and videos stimulate interest and improve user experience on the site. This in turn leads to more purchases and conversions.

Media play an important role in driving more traffic to the website and improving its SEO ranking.

Working in WordPress isn't always trouble-free. Some users have experienced problems with uploading media on their site. They run into an error message which doesn’t include an explanation of what exactly caused the issue.

The WordPress add media button not working error can be frustrating. At first, it may not be clear how to fix it.

This article presents some possible sources of this error and tips on how to remove it.

Why the WordPress Add Media Button Not Working Error Occurs

 

The WordPress post editor uses JavaScript for all screen buttons, including the Add Media. Sometimes the JavaScript conflicts with other scripts or stylesheets, such as custom scripts, plugins, and themes.

WordPress is set by default to load all plugins and themes installed on the site at the same time. It combines all the requests to enhance the speed and the performance of the website.

However, when the JavaScript that runs the Add Media button conflicts with another script, the Add Media button stops working.

This is usually the root cause of the Add Media button not working error.

There is a similar error that occurs during content upload. It's the Insert into post button not working error. This malfunction is caused by permission errors on a folder.

Here are some tips on how to fix the Add Media button not working.

A Temporary Fix

The previous section explained that the error occurs when there is a collision between some scripts that are loading at the same time. So a quick, but temporary, fix is to process one request at a time. This momentary solution will enable the Add Media button to complete the content upload.

Adding a line of code to the wp-config.php file will disable the combined loading of many scripts. Instead, they will be processed individually.

Here are the individual steps:

1. Go to the cPanel and open the File Manager.

 

2. In the public_html directory find the wp-config.php file.

3. Create a backup of the original file before making any modifications.

4. Right-click on the wp-config.php file and click on "Edit".

 

5. A new window will open. If you have already secured your files by creating a backup, click on "Edit".

 

6. In the code, scroll down to the bottom. Above the “/* That’s all, stop editing! Happy blogging. */” line, copy and paste the following code:

define(‘CONCATENATE_SCRIPTS’, false );

7. Click on "Save Changes".

 

8. Try the Add Media button again.

This technique should fix the problem of colliding requests. Each script will be loaded separately and the Add Media button will work again. But the speed and performance of the site will be lower.

A more definite solution is to identify the script that is causing the Add Media button not working error.

A Long-term Fix

To remove the error completely, it's necessary to identify the script that is causing the conflict.

Every site uses many different plugins and custom scripts. These can include added search boxes, shopping carts, or discussion boards. Some premium themes also use their own built-in plugins.

 

To check which script is causing the issue, you can use the inspect tool in your browser. The Console in the Developer tools can perform an inspection and find the error.

To verify if the root cause is a plugin, you can deactivate all your WordPress plugins. Make sure to perform the process on your offline website.

1. Go to the WordPress Dashboard.

2. Navigate to the Plugins option in the menu on the left side.

 

3. Deactivate the plugins.

4. Try the Add Media button. If it works, it means that one of the plugins was the source of the error.

5. Activate the plugins one by one. After each activation check if the Add Media button is working until you find the faulty plugin.

 

6. Contact the plugin developer for technical support or replace the plugin.

 

If this didn't resolve the problem, clear your caches.

 

The active theme could also be the cause of the error. To check it, switch to a default WordPress theme or one that doesn't use any built-in plugins. A problem with a theme can be resolved by replacing it or contacting the theme developer.

After identifying the script problem on the offline site, you can fix it on the live WordPress site.

Removing Add Media For Non-Admins

 

In order to manage who uses the Add Media button, it's possible to remove the permission from the non-admins.

To hide the Add Media button, add the following code to the functions.php file:

function RemoveAddMediaButtonsForNonAdmins(){
if ( !current_user_can( ‘manage_options’ ) ) {
remove_action( ‘media_buttons’, ‘media_buttons’ );
 }
 }
add_action(‘admin_head’, ‘RemoveAddMediaButtonsForNonAdmins’);

Editors can have permission to edit pages. To do that, you can change the 'manage_options' in the code to 'edit pages'.

Ending thoughts on WordPress add media button not working error

When the Add Media button is not working, WordPress users can't upload images and videos on their site. This can affect not only the user experience and traffic on the page, but also the site's SEO ranking.

There are two ways of fixing the error- temporarily by adding a line of a code to wp-config.php. This step will prevent a conflict between scripts that are loading simultaneously. Instead, the requests will be processed one at a time.

The limitation of the short-term solution is that it doesn’t remove the cause of the Add media button not working error. Also, loading scripts one by one negatively affects the speed and performance of the site.

The long-term solution is necessary in order to avoid the same issue in the future. It requires identifying the faulty script that triggers the error. Checking the custom scripts, plugins and themes will most likely pinpoint the root cause.

Finally, making sure that the site's cache is clear and removing old code and script should resolve the problem.

If you enjoyed reading this article on WordPress add media button not working error, you should check out this one about Wordpress mixed content errors.

We also wrote about a few related subjects like failed to open stream error, WordPress post missed schedule, failed to load resource error, WordPress posting to Facebook done automatically, how to reorder pages in WordPress and WordPress updating failed error.

Albert Ślusarczyk
Albert Ślusarczyk
As the co-creator of Be Theme, I am a strong believer in designing with care and patience. I pour my energy, time & knowledge into perfecting the theme for our 195,000+ customers.

Comments are closed.

Free cheat sheets available

Subscribe to download a set of cheat sheets for CSS, JS, and HTML

You'll receive an email with the cheat sheets in an instant.