Forums

Authors Widget
Alter authors query to improve slow lookup on blogs with many users. (1 post)

  1. aaronerk
    Member
    Posted 6 months ago #

    For blogs with lots of users (10,000+), your queries to lookup authors and author post counts take a really long time. I'm not sure how backwards compatible the below code snippet is, but it dramatically speeds up the plugin if you can use it.

    $user_args = array(
    'fields' => array('ID', 'user_nicename'),
    'who' => 'authors'
    );
    $wp_user_search = new WP_User_Query($user_args);
    $authors = $wp_user_search->get_results();
    $author_ids = array();
    foreach($authors as $author) {
    $author_ids[] = $author->ID;
    }
    $author_count = count_many_users_posts($author_ids);

    http://wordpress.org/extend/plugins/authors/

Reply

You must log in to post.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 6 months ago by aaronerk
  • This topic is not a support question
  • WordPress version: 3.2.1