Another, better, way to do this would be to do a couple of different things:
- Locate the filters that are running those queries in wordpress SEO and remove them
- Look at the data they are gathering to display in the list of posts and use the posts_join and posts_fields filters to add the data they are gathering via their individual queries into the query being ran to generate the post list.
For example, the query you showed:
SELECT t.*, tt.* FROM wp_terms AS t
INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id
INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
WHERE tt.taxonomy IN ('post_tag') AND tr.object_id IN (37336)
ORDER BY t.name ASC
This query is gathering term_taxonomy and term_relationships entry for some purpose (most likely to show which posts have had seo type things done to them.
If you figure out specifically what is being looked for, you could then come up with appropriate query segments to alter to pull out just what is needed for each post.
If you can do this to simply add a couple more fields for each post to the results list without making the post list return multiple records for each post, then you could remove their display filter as well and have it simply pull the fields from the current post.
This would basically remove all of the extra queries inserted by WP SEO and let you get the data that they display for almost no extra work (just selecting two additional fields from the database).
If they are using a serialized array for each post, you will probably need to do something like:
append something like
LEFT JOIN (post_meta) ON (post_meta.post_id = post.ID)
append something like
(post_meta.meta_value) AS seo_meta
Then remove their filter on the columns and add your own that simply unserializes the seo_meta value and draws the appropriate data out.
If they aren't using a serialized array, then you would just make a few extra left joins (which will set seo_meta to null if it does not exist) and a few extra field names.
I'm actually doing this in a few of my plugins and tracked down all of the details that I needed to do it via the following (along with digging through some of the source):
- If doing the above, make sure to use is_admin() and appropriate other checks to modify the query only in the admin side when grabbing lists of items for the appropriate screens.