yoast-acf-analysis
yoast-acf-analysis copied to clipboard
Fixing issue with too many calls to admin-ajax.
Summary
This PR can be summarized in the following changelog entry:
- Seems that unnecessary calls where being made to query_attachments it was making calls even when the attachment ids were empty.
- The issue was when the attachment_id value was getting fetched there was no check to see if it was empty before it was added into the array which made the attachment_ids never empty.
- Added validation before attachment_id gets added to array.
Test instructions
- Visit edit post page and make sure unnecessary calls are not made to the action query_attachments.
Fixes #
- Fix for #120
Travis CI build is failing due to maximum warnings reached seems the more instances attachment_id of brought it over the max.
Thanks for your PR! 🎉 I only had a quick look at it and it seems as if the check is probably better done in the cache itself as an empty ID never makes sense. Also I'd like to find out why there are empty IDs in the first place. I think this still needs some work although it is a great start.
@kraftner Moved the check into the cache refresh function. The empty id seem to to happen due to an image has not been set on a image field or gallery field the value is empty when the scrapper gets to it.
Hi, i still have the problem.
Too much get-attachement admin-ajax.php requests with yoasts plugin enabled
When I edit a page of the site the loading time is very high and the consumption of RAM and CPU is also very high.
In the network inspector I see that there are too many requests to the admin-ajax.php script with the get-attachment method.
This happens when I have the Yoast SEO plugin activated, if I deactivate Yoast these requests are not made.
I have all the plugins updated.
Screenshot: https://pasteboard.co/JCttWFz.jpg https://pasteboard.co/JCtu9kf.jpg
How can I solve?
---- Configuration ---- Theme The7 v.9.3.1 The7 WPBackery Page Builder 6.4.2 Ultimate Addons for WPBakery Page Builder 3.19.7 Yoast SEO 15.3
I tried PHP 7.2, 7.3 and 7.4 PHP Max Input Vars: 10000 PHP Memory Limit: 512 MB PHP Time Limit: 360