Home › Forums › Pro Support › Heavy MySQL Usage via admin-ajax.php › Reply To: Heavy MySQL Usage via admin-ajax.php
My hosting company (WPX Hosting – I need to shout them out because they have been gems in holding my hand through this) has just made a very useful discovery. I’ll quote:
I have just tested that but the query is directly called from the action ‘admin_init’ with function ‘wpsp_pro_update_read_more_values’ in WP Show Posts Pro – ./wp-show-posts-pro/inc/admin.php – https://imgur.com/3Gpa3pw which is somehow bound to every ‘admin-ajax.php’ call.
Note: admin_init – “It runs on admin-ajax.php and admin-post.php as well.” – Source: https://codex.wordpress.org/Plugin_API/Action_Reference/admin_init
Here is what I tested on the staging site:
1. I disabled/enabled each plugin and checked on which request was the query called.
-The query was called on every ‘admin-ajax.php’ request when I was logged in in the ‘wp-admin’ area of the site even if all plugins were disabled except for ‘WP Show Posts/Pro’.
2. When there aren’t any ‘admin-ajax.php’ calls then there isn’t an issue because this specific function is not being executed on the front-end of the site.
-If Thrive Leads is disabled then there aren’t any ‘admin-ajax.php’ calls and the queries are not being called on the front-end for non-logged in users.
-This can happen with other plugins that use the ‘admin-ajax.php’ for handling actions, as proof, I have tested it with the plugin ‘Post Views Counter’ that runs an ‘admin-ajax.php’ call on every post/page visit and managed to see the query running on each one when Thrive Leads was disabled.
If ‘WP Show Posts’ doesn’t make the query via the ‘admin_init’ on each ‘admin-ajax.php’ call then those queries won’t be called on the front and backend of the site.
I hope this helps and the plugin developer might be able to provide a fix that can avoid the query call on each ‘admin-ajax.php’ request.
Don’t really have much else to add to this – I hope that helps Tom 🙂