How to Fix Add Media Button Not Working in WordPress.

About This Presentation
Title:

How to Fix Add Media Button Not Working in WordPress.

Description:

This article will help you to understand the cause and solution to fix the issue.The WordPress post editor uses JavaScript for all buttons on the screen. A conflict can prevent JavaScript from working which will disable the ‘Add Media’ button. –

Number of Views:28
Slides: 8
Provided by: Shikha2105
Category: Other

less

Transcript and Presenter's Notes

Title: How to Fix Add Media Button Not Working in WordPress.


1
(No Transcript)
2
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.
  • Lets fix add media button not working in
    WordPress.

3
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 Thats all,
    stop editing! Happy blogging.
  • 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.

define(CONCATENATE_SCRIPTS, false )
4
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.

5
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 , RemoveAddMediaButtonsF
    orNonAdmins )

6
Access Own Media Only
With this code, the administrator can see all the
media. If youd 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-gtuser_login //if is admin or
is_user does not equal username if
(!current_user_can(manage_options)) //if in
the admin panel if(query-gtis_admin) global
user_ID query-gtset(author,
user_ID) return query return
query add_filter(pre_get_posts,
my_authored_content)
7
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-butt
    on-not-working-in-wordpress/
Write a Comment
User Comments (0)
About PowerShow.com