70 likes | 88 Views
A content without images and media looks incomplete and if the Add Media Button is not working leads your good content to reach late to your users. This article will help you to fix this issue and explain the cause also. For more information visit our link-https://www.wpglobalsupport.com/fix-add-media-button-not-working-in-wordpress/
E N D
What is the reason of not functioning of Add Media Button? The cause of not working of Add media button is due to irrelevant script or style loaded by WordPress plugin or theme installed on your website. Add default behavior of WordPress is to load all required scripts and stylesheets by combining the request. Commonly is done in the WordPress admin area to improve performance and speed of website. The WordPress post editor uses JavaScript for all buttons on the screen, which includes the button. A conflict can prevent JavaScript from working which will disable the ‘Add Media’ button. Let’s fix add media button not working in WordPress.
Fixing Add Media Button Not Working Issue in WordPress For a quick fix add the following code to your wp-config.php file. This can be Done 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 features. After adding the code, go ahead and edit the visit post screen to see if the media is working as expected or not. This is not a long term solution.
Fixing Add Media Button Not Working Issue in WordPress For a Long term solution 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 WP Engine, 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, try to find out which plugin is creating this issue by activating each plugin one by one and check the activity of Add media Button.
Hide “Add Media” Button from Non-Admins 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 RemoveAddMediaButtonsForNonAdmins() { 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’d 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: Here, We discussed: The causes of not working of Media button. How To fix the Not Working of media button in WordPress. ● ● We Hope that this post will help you to solve the issue. For more information visit our link https://www.wpglobalsupport.com/fix-add-media-button-not-working-in-wor dpress/