Slow Query in WordPress | WordPress.org

[ad_1]

I have a WordPress site with a large user db more than 1 million users.

I am seeing a slow query in the logs and it looks like this:

SELECT wp_users.ID
FROM wp_users INNER JOIN wp_usermeta ON ( wp_users.ID = wp_usermeta.user_id )
WHERE 1=1 AND (
( wp_usermeta.meta_key = ‘wp_user_level’ AND wp_usermeta.meta_value != ‘0’ )
)
ORDER BY display_name ASC
LIMIT 0, 50;

I want to find what is triggering it and stop it from executing this query. (Listing admins and authors is not something I’m intending on using.

I have already tried the below with no luck:

add_action(‘init’, function () {
foreach ([‘page’, ‘post’, ‘wh_jobs’, ‘wh_edu’, ‘wh_glossary’] as $type) {
remove_post_type_support($type, ‘author’);
}
});

I suspect that this is likely triggered by someone browsing posts or writing something in wp-admin

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer