0

Media Library is not loading on grid view and also featured image not select any image from post and page . The progress circle keeps spinning. Due to this issue, I am not able to add any image in the post as insert image option also opens in “grid view” by default.

The things I tried but not resolved my issue:

  1. Removed all plugins. Switch to twenty sixteen theme.
  2. Deleted whole wordpress installation. Installed fresh.
  3. Enabled script debug.Doesn’t show any error in console. Tried reloading the page too.

I am not able to do anything on my website for many days now, please help me.

0

I ran into a similar issue with the same symptoms. What I determined was in my theme's function.php there was a DEBUG statement that output some html. While this was fine for browsing, when the POST request came into admin-ajax.php to refresh the thumbnails, it was causing the infinite spinning wheel and not showing images. I removed the output from functions.php and problem was resolved.

Not sure if this will work for you, but I found the issue by using the following command:

curl -X POST http://YOUR_DOMAIN_NAME_HERE/wp-admin/admin-ajax.php -d 'action=query-attachments&post_id=0&query[orderby]=date&query[order]=DESC&query[post_per_page]=40&query[paged]=1'
-1

I know this thread is old, but I just solved this and maybe my solution can help others. I also was not able to create any posts. My site had the list view working, but not the grid view, and every upload actually did go through although the upload feature would display the typical (media upload failed) error. I was able to view all of my photo uploads in /wp-content/uploads even after the library error.

I am new to PHP, and learning how to write my own scripts. I wrote a script to hide menu items/notices on the admin pages for my client, and I used:

add_action('admin_init' , 'makeDashboardPretty');

to hook into the admin pages to do this. This would run my script before anything on the admin page would load. One of the items I hid was my theme's menu item, which apparently needs to load in order to get the media library/posting working. I think the echo ''; ?> css in my script would prevent my theme from enabling the media library/posting features.

I changed my admin hook to:

add_action('wp_after_admin_bar_render' , 'makeDashboardPretty');

which allowed my script to initialize after my theme's menu item did. This enabled me to hide the item and still get the theme working.

  • 1
    Your CODE is not clear. e.g. what's inside the makeDashboardPretty function. What did you mean by: "I think the echo ''; ?> css in my script would prevent my theme from enabling the media library/posting features". Please clarify. – Fayaz Jun 19 '18 at 20:29
-2

I faced same issue on my wordpress site. After the lot of debugging i fixed my problem step by step.

  1. First add given below code your db-config.php
define('SCRIPT_DEBUG', TRUE);
define('WP_DEBUG', TRUE);
define( 'WP_DEBUG_LOG', true );
  1. Then goto /wp-includes/js/wp-util.js files and find the code $.ajax( options ) on line number 100(depand your wordpress version) insert given below code into your file
deferred.jqXHR = $.ajax( options ).done( function( response ) {
  try {
      response = JSON.parse(response);
  } catch (Exception) {
      response = response;
  }

Please check your may be resolved.

  1. if you Removed constant from db-config.php
define('SCRIPT_DEBUG', TRUE);
define('WP_DEBUG', TRUE);
define( 'WP_DEBUG_LOG', true );   
  1. Then compress your /wp-includes/js/wp-util.js file code and put your compressed code into /wp-includes/js/wp-util.min.js
  • i know i changed in my core file... but have you another solution related question.. – Pavnish Yadav Jun 1 '17 at 6:45
  • if the solution include changing core files, it is just not a solution as the next update will overwrite it – Mark Kaplun Jun 1 '17 at 6:57
  • the problem is probably some plugin interaction or (unlikely) some server misconfiguration. – Mark Kaplun Jun 1 '17 at 6:58
  • I do everything above mention points. There will be no solution. Wordpress can not convert my json to object json. So i find problem and answer it. – Pavnish Yadav Jun 1 '17 at 7:03
  • This did solve my version of the problem but I dug deeper to look for the issue. Turns out that WP does multiple calls to header() and therefore the correct Content-Type application/json is not set, but is text/html instead. This causes the grid not to load images. See my question about this here: serverfault.com/questions/899169/… – TheStoryCoder Feb 27 '18 at 18:00
-2

I had same problem before few days. I tried to use the function ob_start();

on top in function.php file of active theme. And Media Library loaded well.

  • 2
    This is... just not helpful. Also, if ob_start at the top of your functions.php solved the problem, something in your functions.php is seriously wrong. – HU ist Sebastian Oct 23 '17 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.