• Hi,

    I tried to setup my page from scratch as a wanted to use another theme. However I want to take over my posts and media files (about 2900).

    In the past that worked fine using the old “Add from server” plug-in to re-import the media files in the exact year/month structure I had it initially setup. Sadly WordPress does not provide any other custom folder structure out of the box (which I do not understand till this day as these year-month folders only make problems for migrations etc. and a flat list with 2900 items is not usable – but different story).

    So I did the whole migration just fine locally. Then took the sql export and replace the domain from localhost to the one it’s running on an uploaded the files.

    The problem:

    As long as I run the page locally I can go the the “Media” page and click “Load more” in Grid-view mode. It will load the next 80 items for e.g. a selected date in the filter. The only strange thing I experienced locally was that sometimes the items were appended at the end and sometimes at the beginning.

    Now if I do the same on the remote-server, it displays 80 images for the filtered date in Grid-view mode just fine. However, once I click on “Load more” it loads sth. and then just adds 1 more. So 81 images and then nothing. I can click on it again and again, no more images loaded.

    What I tried:

    I looked a the network request and the server returns the “next page” (the json contain all media files 81-160) just fine, but somehow I don’t see the images itself being loaded. While locally I see the images itself being loaded after the “next page” has been returned.

    • I disabled the theme and all plug-ins.
    • Tried it with WP 6.2 and also 5.9.5, both same issue.
    • Locally I setup the page using PHP 8.2 and nginx.
    • Remote I’m running PHP 8.2 (tried also 7.4 and 8.0) and Apache (.htaccess file from WP-docs is present)
    • Folder and file permissions are correct.
    • Health-Check does not list anything other then “Performance” and “Security” if I have the theme+plugins disabled.
    • I also tried to delete all media items (including validating that everything is cleared from the DB from those deleted items) and tried other plug-ins to import the files (“Add from server”, “Media Sync”, “Bulk Media Register”) no difference in behavior on remote server.
    • I don’t see any errors or error logs when I enable those options in wp-config. Not in the Chrome console (latest Chrome) and not on the .log file on the server.
    • If I have “filebird-pro” enabled which hides the “Load more” button it endlessly tries to load the “next page” and never stops. So this does not help/solve/improve anything.

    Workarounds which do not work (for me):

    • I tried to manually upload the files and then it works, however then they are basically all in a flat list as WordPress does not provide any option to create a custom folder structure or to take the EXIF date or similar into account – this is just not usable with 2900 files.
    • If I switch to List-view, everything works just fine, even with the imported files. Only in Grid-view it does not work. Which would be a workaround but when I edit a post and want to add a media file, then I only have Grid-view and no option to switch to list-view. So that is also not an option as a workaround.

    Somehow I’m lost in how to find out what’s wrong to be able to issue a bug report as I think that the initial issue seems to be with the import of the data. However there is also no error logged or displayed by WordPress itself why it does not load the media items after it loaded the “next page” data successfully.

    I enabled script-debug (SCRIPT_DEBUG) but still some jquery and other stuff is still minified, so hard to debug. Any ideas where exactly the “next page” is iterated and where the request for a single file to be loaded is located? So that I can try to find out why it does not load these files and stops processing the items from the “next page”.

    I’m also open for any other recommendations in how to import my files by preserving the folder structure that they can be filtered by year-month.

    Thanks.

Viewing 1 replies (of 1 total)
  • Hi,

    unfortunately I don’t have a clear solution for you here but I have some ideas how you can find out what’s wrong.

    If you know how to use the browser’s inspector to view network requests, you can go to the grid view just to the point before you encounter the only-one-image loading problem.

    Then observe a request to admin-ajax.php as you click the button. If you then click that request, you’ll see data on the right side of the window. Something like this:

    {
        "success": true,
        "data": [
            { "id":123,title":"title", ... }
            // Look here if you see multiple of these entries or just one!
        ]
    }

    So, to determine if the problem is on the server-side or in the JavaScript, you’ll need to check if the server returns just one item in the data array or multiple ones.

    If the former then maybe there is some data corruption in the database, if the latter then maybe there is a JavaScript error (maybe a browser extension) that prevents from more than one image being displayed.

    Hope this helps you to identify this issue!

    PS: Did you just try to use the official WordPress importer plugin? It will download the images from the old server during the import.

Viewing 1 replies (of 1 total)
  • The topic ‘Media library not loading more than 81 items’ is closed to new replies.