2.3.1 Puzzling Media Library Behavior

I’ve noticed that the default media library “Number of items per page” is now 10, whereas earlier it was, it seems, considerably larger (I never really noticed; was it an endless page?).

PAGE 1: When I set the “Number of items per page” to be anything higher than 10, e.g., 100 or 200 or 300 etc., the first page will indeed now include that number of images in the larger thumbnail view.

PAGE 2, 3 etc.: But the second and every subsequent page still default to 10, rather than the setting in “Number of items per page” (100 or 200 etc.), albeit in the correct image sequence.

PAGE 1: When I return to the first page from the second page, the first page defaults back to 10 images per page even though the “Number of items per page” is still set to 100 or 200 etc.

A page reload (or hard page reload) of that first page correctly repopulates the page with the number set in “Number of items per page” (100 or 200 etc.).

PAGE 2 AND THEN BACK TO PAGE 1: A page reload (or hard page reload) of page 2 repopulates it with the correct number set in “Number of items per page,” but then returning to page 1 repopulates page 1 with the original default number of only 10 images.

PAGE 3: More peculiar yet (to me), moving to page 3 from the repopulated page 2 merely duplicates the original 10-image-default page 2, not what page 3 would / should be after page 2 with the number set in “Number of items per page” or even the default 10-images.

A page reload (or hard page reload) or page 3 correctly repopulates that page with the stipulated number set in “Number of items per page.”

PAGE 4: same peculiar behavior: Moving to page 4 from the repopulated page 3 similarly defaults to the original 10-image page 2; a page reload repopulates it with the number set in “Number of items per page” for page 4.

Is this normal or intended behavior for the new media gallery? I’m not sure I understand the logic.

The default number of files has been left the same as before (80). However, you can check what it is on you site by clicking on the Screen Options at the top right (just as you can with posts and pages). You can also set the number there to whatever you like.

I can’t reproduce the duplication behavior you describe. So I’m wondering if you have something else that’s interfering on your site. Have you cleared all caches?

Thanks for the response. Yes, I’m using the Screen Options for setting (and saving) the “Number of items per page” as described above, but the result is the same. I’ve cleared all the caches with the LiteSpeed plugin’s “purge all” option, but it makes no difference. It’s not the end of the world, but it only started with 2.3.1, and I’d like to have it working correctly.

How odd. I’m sure you are but, just in case, are you hitting Apply after you’ve changed the number of items?

Do you have DEBUG on? If so, are you seeing any errors in the console or in debug.log or error.log?

Debug is not on; I’ll try it from the server side. What exactly am I looking for in the log?

I don’t know because I can’t reproduce this behavior. If you can DM me what you find, then we might find a clue.

I just tried in Grid view changing from the default view of 10 to 50, site has nearly 1400 images uploads - pagination all worked as I’d expect, sets of 50, 28 pages and each page loads up the next 50 images.

Could this be object caching on the server or a plugin?

Thanks for trying to reduplicate the problem.

I’m unsure what the answer to your question is. Although I am using the LiteSpeed Cache plugin, object caching is not turned on. Setting it up is beyond my skill set but is one of the items on my to-do list if I can find someone to help. I have read about it online but still don’t entirely understand the parameters as LiteSpeed presents them.

To wit, one of the suggestions in my Site Health Status is: " You should use a persistent object cache."

Is your question implying (1) that I should be using object caching or, to the contrary, (2) that using object caching might be part of the problem?

Thanks again.

Matt is suggesting that object caching could be causing your problem. So it’s not something to implement until you’ve solved this (though it would be afterwards).

Since you’re not intentionally running any object caching, the most likely cause of your issue is a plugin. You are going to need to deactivate them, clear all caches, and try again. If the library then works, you will need to reactivate the plugins one by one until the issue reappears to identify the culprit.

Object caching is something to look at for your site in time, it’s clearly not the cause of issues right now, but the LiteSpeed plugin could well be.

My sites were migrated to a new hosting provider when my old prover was bought out, this came with a learning curve for me for LiteSpeed. I fairly regularly see glitches - like desktop content served to mobile devices for example. All of these are fixed by prying the cache. This can be done from the Admin Bar or visit LiteSpeed Cache → Toolbox, then either Purge All to perhaps Empty Entire Cache.

I also had some odd issues when using the litespeed plugin, and while the health suggestion is to use one, my own performance tests did just as well if not better without them. If you have a significant amount of traffic or a slow server using remote caching they may help performance, but I would say unless you have heavy traffic you might not need it.

Yes, page caching is highly overrated in my view. Object caching, on the other hand, makes a huge difference.

Thanks for everyone’s input, esp. about object caching.

Doing a purge all (via LiteSpeed) and then deactivating all plugins does not address the problem.

@MattyRob I did not do an Empty Entire Cache, since the warning is that “this action should only be used if things are cached incorrectly,” something I don’t know.

Oddly, after going into admin today for the first time and going straight to the media library, the behavior moving through the pages was almost normal for a few clicks, then reverted.

@Doug - I think the nuclear options might be worth a try - if this is due to incorrect caching then emptying the entire cache will fix things. The impact on your site will only last as long as it takes the cache to rebuild as visitors hit your site.

Thanks @MattyRob - Well, that did not affect the behavior either. You mentioned the number of images on your site: could that be an issue? I have far more than you mentioned. That said, I realize the some photographers’ sites have more yet.

I can’t think why the number of images would be the cause. Have you tried loading that same page in a Private / Incognito browser window? Does the same issue persist?

@Doug, have you tried using a different browser? And do you have any plugins installed in the mu-plugins folder?

And do you have any error messages in the browser’s console?

@timkaye I just checked Safari (I normally use Firefox): instead of populating the first page with 10 images regardless of number of items per page stipulated, it populates that first page with only 1 image. Then the odd behavior continues as in Firefox.

I will say that generally Firefox now populates that first page with the correct number; it’s the subsequent pages that do not function correctly.

I am not using any mu-plugins.

@MattyRob I’m unsure how to load the page in a private/incognito browser window, but I’m guessing the result is going to be the same.

@Doug That means it’s a JavaScript issue. I would expect there to be some error messages in the browser console.

Could not write session state file DOMException: Could not move /Users/dougstott/Library/Application Support/Firefox/Profiles/7enu35ae.default-1436826104535/sessionstore.jsonlz4' to /Users/dougstott/Library/Application Support/Firefox/Profiles/7enu35ae.default-1436826104535/sessionstore-backups/previous.jsonlz4’: source file does not exist (NS_ERROR_FILE_NOT_FOUND) SessionFile.sys.mjs:448:17