100 likes | 120 Views
One of our readers recently reported that the Add Media button on their WordPress site has stopped working suddenly. However, this problem does not display any error or warning which leaves users clueless about why their button is not working. Here In this ppt, we are going to describe How to Fix Add Media Button Not Working in WordPress.
E N D
Fix: WordPress Add Media Button Not Working Issue Here in this article we are going to discuss How To Fix Add Media Button Not Working In WordPress? Add Media Button Stop Working cause Howeverthis problem is commonly caused by conflicting scripts or style loaded by wordpress pluginor theme installed on your website. Add default behaviour of wordpress is to load all required scripts and stylesheet by combining the request. This is commonly done in wordpress admin area to improve performance and speed. The wordpress post editor uses javascript for all button on the screen, which include the button. A conflict can prevent javascript from working which will disable the “Add Media” Button.
It is being said, let's see how to troubleshoot and fix the button that is not working in wordpress. Fixing WordPress Media Button not working issue The quick fix is to add the following code to your wp-config.php File. you can do it by editing the Wp-config.php file and you can add this code right before the line which says that's all, stop editing!happy blogging. define(‘CONCATENATE_SCRIPTS’, false ); This code simply asks wordpress to load every script separately, which helps to avoid javascript collision with the buggy script and core wordpress feature.
After adding the code, go ahead and edit the visit post screen to see if the media is working as expected or not. If you want a long-term fix for this problem, then you need to perform the basic wordpress troubleshooting tips to figure out which plugin or theme may be causing the problem. We strongly recommend that you do this on your staging website instead of the live site. All the best WordPress hosting companies like WPEngine, Bluehost, SiteGround, and Liquid Web offer 1-click staging functionality On your staging site, you have to start by deactivating all your WordPress Plugin and then checking whether it fixes the ‘Add Media’ button or not. If this happens, then it means that one of the plugins was causing the issue.
Now you can activate the plugin one-by-one by activating a plugin check the button. After finding the culprit, you can replace it with any other plugin. If deactivate plugin does not solve the issue, then the next step is to temporarily switch to a default wordpress theme such as twenty-seventeen.
Hide ”Add Media” Button from Non-Admin Add the following code to your function.php file. It will hide buttons from all non-administrators. If you want to allow editors to view buttons, you can change ‘manage_options’ to something that editors are allowed to do, like ‘edit page’. Function Remove Add Media Buttons For Non Admins if ( !current_user_can( ‘manage_options’ ) ) { remove_action( ‘media_buttons’,’media_buttons’ ); } } add_action( ‘admin_head’ , ‘RemoveAddMediaButtonsForNonAdmins’ );
Access Own Media Only With this code, the administrator can see all the media. If you would like to let editor see all the media too, you only have to something that editor is allowed to do, like edit page. /** * Allow access to own content only */ function my_authored_content($query) { //get current user info to see if they are allowed to access ANY posts and pages
$current_user = wp_get_current_user(); // set current user to $is_user $is_user = $current_user->user_login; //if is admin or ‘is_user’ does not equal #username if (!current_user_can(‘manage_options’)){ //if in the admin panel if($query->is_admin) { global $user_ID;
$query->set(‘author’, $user_ID); } return $query; } return $query; } add_filter(‘pre_get_posts’, ‘my_authored_content’);
Conclusion In this article, we have described to you how to Fix Add Media Button in WordPress and covered major topic. After that, we have discussed some topics: What causes the WordPress Media Button to Stop Working? Fixing Add Media button Not Working Issue in WordPress Hide “Add Media” Button from Non-Admins