How to Fix Add Media Button in WordPress?

During WordPress template customization tasks such as adding videos, images or GIFs, often the Add Media button becomes unresponsive and does not respond. As the website does not reply via any mode of mentioning ‘error’, users are left bamboozled and utterly helpless in such situations. Imagine, you cannot post any media on your posts and you do not know why is that happening? Ridiculous right? We have curated this article to help users understand why is the problem occurring and how to get rid of this problem.

The error is brought into the picture due to conflicting CSS, stylesheets or scripts that naturally come with the installing and usage of several WordPress plugins, widgets, and themes attached to your website. WordPress has a habit of combining requests to load all stylesheets, scripts, etc. Due to this over-cluttering, the JavaScript is halted and the Add Media button becomes useless.

Reigniting the functionality of your Add Media button is no painstaking task and can easily be done without the help of a WordPress web designer. There is a simple piece of code – define(‘CONCATENATE_SCRIPTS’, false); – that instructs WordPress to load individual scripts individually itself and avoid the cluttering of features, stylesheets, scripts, etc. This code has to be added to the wp-config.php file by editing it. Make sure it is the last line of code before the statement ‘That’s all, stop editing! Happy blogging!’ The code is a transient solution for your inability to add media onto your posts. You rather make use of the Inspect Tool and navigate through the displayed console errors to identify the root cause of these conflicting requests.

Ideally, one must resolve this issue once and for all via identifying the one plugin that is causing all the hurdles. This requires the setting up of a staging site. Do not fret over the term staging (offline) site, as several web hosting companies provide a one-click stage functionality.

Once you are on your staging site, head to the dashboard and click on Plugins from the left column. One by one, deactivate each WordPress plugin and check simultaneously whether the Add Media button is working or not. While attempting this brute force method, you will sooner or later diagnose the problem by busting the plugin causing the dysfunctionality of the Add Media button. Once you have found the malfunctioning plugin, you can either contact the plugin owner for help, deactivate the plugin for good, or replace it with one of the hundreds of alternative options on the world wide web.

Occasionally, deactivating a plugin does not seem to suffice. This is when you have to tweak your usage of themes a little bit to check for further possible problems. Switch from your chosen theme to a default WordPress theme and check if the Add Media button begins to work then. If it does, you have identified your culprit. Similarly, if you yet want to use the theme, contact the theme author and resolve the problem together.

Another catch that must be considered is one that involves authorized 3rd party users. Often a website owner may permit other editors, blog authors, digital marketers, photographers, videographers, contributors, etc. to curate a post. This means there are several users and they all have their own requirements to be completed. These individuals can add media to your posts as and when they please If you want to restrict them from media-related WordPress template customization then simply hide the ‘add media’ button. To hide the ‘add media’ button, you have to append the following code into your functions.php file.

  • Line 1 – function RemoveAddMediaButtonsForNonAdmins(){
  • Line 2 – If (!current_user_can( ‘manage_options’)){
  • Line 3 – remove_action( ‘media_actions’, ‘media_buttons’);
  • Line 4 – }
  • Line 5 – }
  • Line 6 – add_action(‘admin_head’, ‘RemoveAddMediaButtonsForNonAdmins’)

If you want to permit only one specific individual to add media to blog posts and articles then change the ‘manage_options’ in Line 2 to anything that allows editors, photographers or videographers to work freely. This can be ‘edit pages’, ‘add photos’ or ‘add videos’ respectively.

If these above steps are followed with utmost precision and order, then the odds of the Add media button issue persisting is zero. Keep in mind, if you succeed in navigating yourself to find the source of the problem while on the staging website, then you must also deactivate or replace the malfunction-causing plugin on the live website.