Maxed Entries?
-
Hello, I was wondering if the gallery assistant had a max number of entries or something because just recently it stopped displaying the contents of a single ATT. Category.
https://www.theforgottenlair.net/test/
Basically on that page the latest 40 images in the “mobile” category used to be listed. It was fine loading up to the latest 40 of 1,111 images and after I added 20 more, I noticed all the images disappeared.
I’ve also noticed considerable amount of lag and database error pages whenever I’m assigning a category to an image. Am I just pushing something too far? Thanks.
-
Thanks for your question and for including the link to your Test Page, which is very helpful.
There is no maximum number of entries or other fixed limit for the
[mla_gallery]
shortcode, but your server may be hitting the script time limit before the query can finish. MLA is working on databases with several thousand images (400,000+ in one case) but sometimes requires changing database query techniques to do so. I do not think one or two thousand images will be a problem.It would be very helpful if you could post the source text of the shortcode you are having trouble with. I see that the “Test Page” has no gallery output below the “Latest 40” title, but your site’s Mobile Wallpapers page seems to be working. Is there a difference between these pages?
You can also try adding
mla_debug=true
to the shortcode on your Test Page, which will display a lot of ugly but useful information. In particular, if you see “Empty Gallery” it means the query worked fine but didn’t select any items.I will leave this topic unresolved until I hear back from you. Any additional information you can provide will let me be more specifically helpful.
The Mobile Wallpapers page was where this code used to display the same information as the TEST page, however since it stopped working I had to manually input the image ID, which is what you see now.
This is what came up in the debug:
mla_debug empty gallery, query = array ( 'attachment_category' => 'mobile', 'size' => 'medium', 'link' => 'file', 'columns' => '4', 'mla_caption' => '{+parent_title+}', 'mla_target' => '_blank', 'mla_viewer' => 'true', 'numberposts' => '40', 'order' => 'DESC', 'mla_debug' => 'true', 'mla_page_parameter' => 'mla_paginate_current', ) mla_debug $wp_filter[posts_where] priority = 2147483647 filter name = 'MLAShortcodes::mla_shortcode_query_posts_where_filter' mla_debug $wp_filter[posts_orderby] priority = 2147483647 filter name = 'MLAShortcodes::mla_shortcode_query_posts_orderby_filter' mla_debug WHERE filter = ' AND ( wp_term_relationships.term_taxonomy_id IN (25) ) AND (wp_posts.post_mime_type LIKE \'image/%\') AND wp_posts.post_type = \'attachment\' AND ((wp_posts.post_status = \'inherit\') OR (wp_posts.post_status = \'inherit\' AND (p2.post_status = \'inherit\')))' mla_debug modified WHERE filter = ' AND ( wp_term_relationships.term_taxonomy_id IN (25) ) AND (wp_posts.post_mime_type LIKE \'image/%\') AND wp_posts.post_type = \'attachment\' AND ((wp_posts.post_status = \'inherit\') OR (wp_posts.post_status = \'inherit\' AND (p2.post_status = \'inherit\')))' mla_debug ORDER BY filter, incoming = 'wp_posts.post_date DESC' Replacement ORDER BY clause = 'wp_posts.menu_order DESC, wp_posts.ID DESC' mla_debug posts_clauses filter = array ( 'where' => ' AND ( wp_term_relationships.term_taxonomy_id IN (25) ) AND (wp_posts.post_mime_type LIKE \'image/%\') AND wp_posts.post_type = \'attachment\' AND ((wp_posts.post_status = \'inherit\') OR (wp_posts.post_status = \'inherit\' AND (p2.post_status = \'inherit\')))', 'groupby' => 'wp_posts.ID', 'join' => ' INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_posts AS p2 ON (p2.ID = p2.ID) ', 'orderby' => 'wp_posts.menu_order DESC, wp_posts.ID DESC', 'distinct' => '', 'fields' => 'wp_posts.*', 'limits' => 'LIMIT 0, 40', ) mla_debug posts_clauses_request filter = array ( 'where' => ' AND ( wp_term_relationships.term_taxonomy_id IN (25) ) AND (wp_posts.post_mime_type LIKE \'image/%\') AND wp_posts.post_type = \'attachment\' AND ((wp_posts.post_status = \'inherit\') OR (wp_posts.post_status = \'inherit\' AND (p2.post_status = \'inherit\')))', 'groupby' => 'wp_posts.ID', 'join' => ' INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_posts AS p2 ON (p2.ID = p2.ID) ', 'orderby' => 'wp_posts.menu_order DESC, wp_posts.ID DESC', 'distinct' => '', 'fields' => 'wp_posts.*', 'limits' => 'LIMIT 0, 40', ) mla_debug query = array ( 'attachment_category' => 'mobile', 'post_type' => 'attachment', 'post_status' => 'inherit', 'post_mime_type' => 'image', 'posts_per_page' => 40, 'ignore_sticky_posts' => true, 'no_found_rows' => true, ) mla_debug request = 'SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) LEFT JOIN wp_posts AS p2 ON (p2.ID = p2.ID) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (25) ) AND (wp_posts.post_mime_type LIKE \'image/%\') AND wp_posts.post_type = \'attachment\' AND ((wp_posts.post_status = \'inherit\') OR (wp_posts.post_status = \'inherit\' AND (p2.post_status = \'inherit\'))) GROUP BY wp_posts.ID ORDER BY wp_posts.menu_order DESC, wp_posts.ID DESC LIMIT 0, 40' mla_debug query_vars = array ( 'attachment_category' => 'mobile', 'post_type' => 'attachment', 'post_status' => 'inherit', 'post_mime_type' => 'image', 'posts_per_page' => 40, 'ignore_sticky_posts' => true, 'no_found_rows' => true, 'error' => '', 'm' => 0, 'p' => 0, 'post_parent' => '', 'subpost' => '', 'subpost_id' => '', 'attachment' => '', 'attachment_id' => 0, 'name' => '', 'static' => '', 'pagename' => '', 'page_id' => 0, 'second' => '', 'minute' => '', 'hour' => '', 'day' => 0, 'monthnum' => 0, 'year' => 0, 'w' => 0, 'category_name' => '', 'tag' => '', 'cat' => '', 'tag_id' => '', 'author_name' => '', 'feed' => '', 'tb' => '', 'paged' => 0, 'comments_popup' => '', 'meta_key' => '', 'meta_value' => '', 'preview' => '', 's' => '', 'sentence' => '', 'fields' => '', 'menu_order' => '', 'category__in' => array ( ), 'category__not_in' => array ( ), 'category__and' => array ( ), 'post__in' => array ( ), 'post__not_in' => array ( ), 'tag__in' => array ( ), 'tag__not_in' => array ( ), 'tag__and' => array ( ), 'tag_slug__in' => array ( ), 'tag_slug__and' => array ( ), 'post_parent__in' => array ( ), 'post_parent__not_in' => array ( ), 'suppress_filters' => false, 'cache_results' => true, 'update_post_term_cache' => true, 'update_post_meta_cache' => true, 'nopaging' => false, 'comments_per_page' => '2', 'taxonomy' => 'attachment_category', 'term' => 'mobile', 'order' => 'DESC', ) mla_debug post_count = 0
Empty Gallery did indeed come up. Thank you for your help on this.
Thank you for your update and for posting the
mla_debug
output. Although you did not post your shortcode source, from the debug output I believe it looks like this:[mla_gallery attachment_category=mobile size=medium link=file columns=4 mla_caption='{+parent_title+}' mla_target='_blank' mla_viewer=true numberposts=40 order=DESC mla_debug=true]
If that is right, I suggest you remove the
mla_viewer=true
parameter (which does not work for images) and add theorderby=date
parameter, just to make your sorting intent explicit.Even without those changes, the shortcode looks fine. I entered the above shortcode on my test system and got an “empty gallery” because I do not have a “mobile” Att. Category. When I replaced it with one of my own values I got the images assigned to that value on my system.
As a test, I suggest you change
attachment_category=mobile
to some other Att. Category value that you know has images assigned and see if they are displayed. Or, try replacing theattachment_category=mobile
parameter withpost_parent=all
to verify that the other parameters are working for you.You can also go to the Media/Att. Category submenu and verify that the “Attachments” column is more than zero for your Mobile value. Also make sure you are using the right “Slug” value in your shortcode.
Give those suggestions a try and let me know what you find out.
I tested a new Category called “test” and those images displayed fine. (Currently displaying on the TEST Page.) Post_Parent=all also displays just fine. It’s just specifically the “mobile” category stopped displaying, although it is still populating. The “40 out of 1163 wallpapers” uses the number of images in that att. category to auto display that number.
I mentioned earlier this suddenly happened out of nowhere. Just under 24 hours ago it was displaying all images under the “mobile” category just fine. Also, I noticed the attaching process has also sped up since the gallery stopped displaying. It used to take at least 1-2 minutes for the EDIT MEDIA page to update when I attach an image to a category. Now it’s almost instantaneous.
Thank you for your additional testing and your report of the results. It seems that MLA is working properly and that you have some database problem(s) with your “mobile” category. You might be able to solve the problem by repairing or optimizing your database.
When you go to the Media/Att. Category submenu, what is the value in the “Attachments” column for the “mobile” category? Does it seem accurate?
If you go to the Media/Attachments submenu, do you see “All Att. Categories” in the dropdown to the left of the “Apply” button? If so, try selecting the “Mobile” category from the dropdown list and clicking “Apply” to filter the table by that value. Does the list of items look right?
If all else fails you can delete the “Mobile” term from the Att. Category taxonomy and then re-create it. That may clear the problem, but it will also remove the “mobile” category from all the images in your Media Library. I understand it may be painful to re-assign all the items back to the mobile category once you delete and re-create it.
I am marking this topic resolved because MLA is working properly and I do not have much help to give you with general database problems. If you have any other information or questions, post them her and I will do what I can to help. Please let me know how this turns out; good luck with your application and thanks for your interest in the plugin.
The Attachment column is accurate and is showing the current number of 1,187. The submenu under ALL ATT Category is also correct in filtering 1,187 items.
I think I’ll reassign a new category to all of them first, before removing “mobile” – if at all. I’ve just tried it and it seems to be working.
I have one more question since I have your help. Right now I’m displaying 40 images on the page to prevent a massive loading problem in displaying thousands. Is there a way to paginate through an entire ATT Category? Let’s say 40 per page and if so, would you foresee any massive loading time in doing this?
Thank you so much for your help. You’ve been extremely kind and patient.
I am happy to hear you are working out the database problems and getting the results you want.
Paginating your
[mla_gallery]
results is straightforward, and should not make a significant difference in the performance of your site. Here is a recent support topic that you can adapt to your needs:pagination for PDF in Media Library Assistant
You should have no trouble adapting the shortcodes from that topic to your application. If you have any problems or specific questions, post them here and I will help you get a solution that works for your application.
Thank you. It seems there is a loading time issue when the ATT. Category reaches around 800+ images. The fast attachment loading time I mentioned earlier has now slowed down to a crawl. These images are about 1-3 MB each.
I’ve applied the pagination coding and can clearly feel the lag as it tries to go to the next page. Would this be an issue on my hosts end?
https://www.theforgottenlair.net/test/
Thank you very much for your help.
It seems the new Category has stopped showing as well. I think it has something to do with the number of images I have in it. If it is database related I guess there isn’t anything you can do.
Once again, thank you very much for your help.
Thanks for both of your updates; I regret you are still having trouble with these queries.
If your database is in good order ( and it probably is based on your reports) and you just need better performance you might want to experiment with the “mla-tax-query-example.php.txt” example plugin. You can find it in the
/media-library-assistant/examples
directory.This small custom plugin was developed in response to this earlier topic:
REALLY Slow Queries…….. Help! ??
Once you install and activate the plugin you can change your shortcode to something like this:
[mla_gallery my_custom_sql='attachment_category=mobile orderby=date order=DESC' size=medium link=file columns=4 mla_caption='{+parent_title+}' mla_target='_blank' numberposts=40]
In this example, the
attachment_category
,order
andorderby
parameters are moved into themy_custom_sql
parameter. That signals the custom plugin to replace the standard WordPress database query with a faster custom query. This approach works well with thousands of images and hundreds of taxonomy terms.I hope you will give it a try and that it works for your application. If you need any help adapting it to your site, let me know.
The loading time is great now, but it’s no longer paginating or showing images based on upload date. It’s just showing the 40. But it’s a step closer! ??
Thanks for your update with the progress report. If there is anything I can do to help work through the remaining issues, let me know.
Yes, is there any way to make the gallery display the LATEST items first and then paginate? It simply isn’t paginating at all now. The PREVIOUS link just refreshes the page.
If you can post the complete source text of both of the shortcodes (all the parameters you are using) I can have a look and try to suggest something that works for you. I am sure it can be done.
Here’s what I have
[mla_gallery my_custom_sql='attachment_category=mobile orderby=date order=DESC' size=medium link=file columns=4 mla_caption='{+parent_title+}' mla_target='_blank' numberposts=40] <div style="clear: both; float: left"> [mla_gallery attachment_category=mobile posts_per_page=40 mla_output="previous_page,first" mla_link_text='← PREVIOUS' mla_rollover_text="Previous/first page"] </div> <div style="float: right"> [mla_gallery attachment_category=mobile posts_per_page=40 mla_output="next_page,last" mla_link_text='NEXT →' mla_rollover_text="Next/last page"] </div>
The weird thing is, I don’t even know how what order the current gallery is using. It’s not in alphabetical or date order of any kind.
- The topic ‘Maxed Entries?’ is closed to new replies.