• I am now running 3.9, but the problem started under 3.8.3 – I had hoped upgrading would fix it but no luck.

    Issue: When editing a post and clicking ‘add media’ trying to use existing media from the Media Library simply makes ajax calls to admin-ajax.php over and over, but doesn’t load the images from the media library.

    I have a live site and a development site, I can get both to show the same problem but under different circumstances. Live-site does not load images under normal conditions and under wp-debug=true conditions. Development site loads images under normal conditions, but does not load images under wp-debut=true conditions.

    When watching the console I see the admin-ajax.php file called over and over but it is not loading images. I assume this to be a javascript problem, but I have no java script errors that I can find.

    I have tried deactivating all plugins, and switching back to default themes. Same situations occur under all conditions, strangely enough.

    I am running on GoDaddy cloud servers, and have read there may be issues there with the admin-ajax.php file.

    Previously had the same issue but it went away after clearing a caching plugin – that has not worked this time around.

    Any advice would be much appreciated.

Viewing 15 replies - 31 through 45 (of 51 total)
  • Actually, I have just removed all plugins and installed one by one again. Nothing specific seemed to cause the issue, but all is working fine now. Strange. Something clearly amiss.

    Having same problem on 1 of 20 sites I run at same ISP. Less than 100 of 400 images display in grid (modal) version of media library. Ajax spinner stops after some time, I assume timing out…

    Have deactivated all plugins and changed themes, but problem persists.

    The point at which the displaying stops changes every time images are added to the library.

    Is any more info on this issue available?

    I do believe core code is OK, but few lines could maybe be more robust.

    I have been getting this issue as well, and I see the following errors in the response view of admin-ajax.php in the Chrome Dev tools Network tab:

    Notice: Trying to get property of non-object in /wp-includes/media.php on line 2646
    
    Call Stack:
        0.0003     692248   1. {main}() /wp-admin/admin-ajax.php:0
        1.7622  121695032   2. do_action() /wp-admin/admin-ajax.php:85
        1.7623  121697240   3. call_user_func_array() /wp-includes/plugin.php:505
        1.7623  121697296   4. wp_ajax_query_attachments() /wp-includes/plugin.php:0
        1.7853  122426008   5. array_map() /wp-admin/includes/ajax-actions.php:2188
        1.9517  122762064   6. wp_prepare_attachment_for_js() /wp-includes/media.php:0
    
    Notice: Trying to get property of non-object in /wp-includes/media.php on line 2650
    
    Call Stack:
        0.0003     692248   1. {main}() /wp-admin/admin-ajax.php:0
        1.7622  121695032   2. do_action() /wp-admin/admin-ajax.php:85
        1.7623  121697240   3. call_user_func_array() /wp-includes/plugin.php:505
        1.7623  121697296   4. wp_ajax_query_attachments() /wp-includes/plugin.php:0
        1.7853  122426008   5. array_map() /wp-admin/includes/ajax-actions.php:2188
        1.9517  122762064   6. wp_prepare_attachment_for_js() /wp-includes/media.php:0
    
    Notice: Trying to get property of non-object in /wp-includes/media.php on line 2646
    
    Call Stack:
        0.0003     692248   1. {main}() /wp-admin/admin-ajax.php:0
        1.7622  121695032   2. do_action() /wp-admin/admin-ajax.php:85
        1.7623  121697240   3. call_user_func_array() /wp-includes/plugin.php:505
        1.7623  121697296   4. wp_ajax_query_attachments() /wp-includes/plugin.php:0
        1.7853  122426008   5. array_map() /wp-admin/includes/ajax-actions.php:2188
        1.9630  122799776   6. wp_prepare_attachment_for_js() /wp-includes/media.php:0
    
    Notice: Trying to get property of non-object in /wp-includes/media.php on line 2650
    
    Call Stack:
        0.0003     692248   1. {main}() /wp-admin/admin-ajax.php:0
        1.7622  121695032   2. do_action() /wp-admin/admin-ajax.php:85
        1.7623  121697240   3. call_user_func_array() /wp-includes/plugin.php:505
        1.7623  121697296   4. wp_ajax_query_attachments() /wp-includes/plugin.php:0
        1.7853  122426008   5. array_map() /wp-admin/includes/ajax-actions.php:2188
        1.9630  122799776   6. wp_prepare_attachment_for_js() /wp-includes/media.php:0
    
    Notice: Trying to get property of non-object in /wp-includes/media.php on line 2646
    
    Call Stack:
        0.0003     692248   1. {main}() /wp-admin/admin-ajax.php:0
        1.7622  121695032   2. do_action() /wp-admin/admin-ajax.php:85
        1.7623  121697240   3. call_user_func_array() /wp-includes/plugin.php:505
        1.7623  121697296   4. wp_ajax_query_attachments() /wp-includes/plugin.php:0
        1.7853  122426008   5. array_map() /wp-admin/includes/ajax-actions.php:2188
        1.9727  122815976   6. wp_prepare_attachment_for_js() /wp-includes/media.php:0
    
    Notice: Trying to get property of non-object in /wp-includes/media.php on line 2650
    
    Call Stack:
        0.0003     692248   1. {main}() /wp-admin/admin-ajax.php:0
        1.7622  121695032   2. do_action() /wp-admin/admin-ajax.php:85
        1.7623  121697240   3. call_user_func_array() /wp-includes/plugin.php:505
        1.7623  121697296   4. wp_ajax_query_attachments() /wp-includes/plugin.php:0
        1.7853  122426008   5. array_map() /wp-admin/includes/ajax-actions.php:2188
        1.9727  122815976   6. wp_prepare_attachment_for_js() /wp-includes/media.php:0

    Below that is the JSON reponse with a "success": true, so I know the actual image request is fine.

    When I disable WP_DEBUG, the images load properly.

    For reference, here are lines 2645 and 2646:

    $post_parent = get_post( $attachment->post_parent );
    		$parent_type = get_post_type_object( $post_parent->post_type );

    It seems that $post_parent is not receiving the correct value from get_post().

    djpm05

    (@djpm05)

    Wanted to reply to imkingdavid as this helped me solve my issue. I had modified a core wordpress file to add a meta tag, assuming it would be displayed on all of the frontend pages. It appended my <meta keywords= tag to be beginning of the POST being made to admin-ajax.php, and therefore was no longer valid JSON data, and would not parse properly. I also went in the Chrome Network tab and looked at the response I got from the POST to admin-ajax.php and saw it hiding out there. I reverted my change and it fixed the issue!

    deanpaddock

    (@deanpaddock)

    Thank goodness that somebody else is having this issue. I have spent days trying to figure out what is going on and have failed.
    I am using WordPress 4.0
    I have a clients site that had 736 items in the media library. I uploaded 78 images. I then get a message from the client that they cannot see all the images in grid view.
    Looking in Chrome dev tools-> network I can see that admin-ajax.js is constanly making a request for second page of results.
    Each call to admin-ajax returns 40 items, mine is stuck on the second page.
    I counted the items showing and there are only 79 showing. So, as each call should return 40 items, I manually checked the json array returned by the first admin-ajax call and the second one (which is forever repeating). The second call returned an item in the array that was in the first. I am not sure if this is supposed to happen or if this is what is causing this problem.
    I have no plugins and have tried it on TwentyForteen also.
    I cannot seem to pin down what causes the issue, I have done a clean install on localhost and server but cannot pin down consistently why it happens.

    Stagger Lee

    (@stagger-lee)

    It is very, very strange. In last time they had a lot of changes in core for media management. So i deeply believe it is some line of core code making all this. Not 100% wrong, but could be more robust, some more checks make.

    Stagger Lee

    (@stagger-lee)

    One other thing is also noticeable. When leaving this modal box window open little bit longer Apache server goes as crazy on CPU. Not old notebook.
    Intel(R)_Core(TM)_i7-3630QM_CPU_@_2.40GHz

    Stagger Lee

    (@stagger-lee)

    Installed Media Library Assistant plugin and guess what ? All images show now, up to last one.
    https://www.ads-software.com/plugins/media-library-assistant/

    Come on core people, review your code one more time. If a plugin can make it then core code should make it work too. I will make a topic in WP Trac.

    Stagger Lee

    (@stagger-lee)

    believein

    (@believein)

    I’m seeing the same issue too.

    Insert Media model > Media Library >

    Dropdown options.

    All media Items = shows no images (just spinning loader).
    Uploaded to this page = Displays images.
    Images = shows no images (just spinning loader).

    Installed Media Library Assistant plugin did not solve issue for me.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Let’s create a new thread to discuss your issues; https://www.ads-software.com/support/forum/how-to-and-troubleshooting#postform

    I had the issue of media folder working, but not loading when accessed through post editing, ie “set featured image” or “add media”.

    I found this line of code in my functions.php file and resolved the problem once removed.

    add_filter( 'image_size_names_choose', 'custom_image_sizes_choose' );

    It didnt help. Found something similar in 3 plugins, deactivated all 3 and same problem remain.

    Man, this is totally weird and strange.
    If you disable all plugins, put back default theme, have clean wp-config.php, images are not corrupted, all is updated. Then only thing it can be is something weird in database. But how to troubleshoot this ?

Viewing 15 replies - 31 through 45 (of 51 total)
  • The topic ‘Media Library in post won't load images – calls admin-ajax.php constantly’ is closed to new replies.