get_most_active_blogs

The timeline below displays how wordpress function get_most_active_blogs has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.4

/**
 * Deprecated functionality to retrieve a list of the most active sites.
 *
 * @since MU (3.0.0)
 * @deprecated 3.0.0
 *
 * @param int  $num     Optional. Number of activate blogs to retrieve. Default 10.
 * @param bool $display Optional. Whether or not to display the most active blogs list. Default true.
 * @return array List of "most active" sites.
 */
function get_most_active_blogs($num = 10, $display = true)
{
    _deprecated_function(__FUNCTION__, '3.0.0');
    $blogs = get_blog_list(0, 'all', false);
    // $blog_id -> $details
    if (is_array($blogs)) {
        reset($blogs);
        $most_active = array();
        $blog_list = array();
        foreach ((array) $blogs as $key => $details) {
            $most_active[$details['blog_id']] = $details['postcount'];
            $blog_list[$details['blog_id']] = $details;
            // array_slice() removes keys!
        }
        arsort($most_active);
        reset($most_active);
        $t = array();
        foreach ((array) $most_active as $key => $details) {
            $t[$key] = $blog_list[$key];
        }
        unset($most_active);
        $most_active = $t;
    }
    if ($display) {
        if (is_array($most_active)) {
            reset($most_active);
            foreach ((array) $most_active as $key => $details) {
                $url = esc_url('http://' . $details['domain'] . $details['path']);
                echo '<li>' . $details['postcount'] . " <a href='{$url}'>{$url}</a></li>";
            }
        }
    }
    return array_slice($most_active, 0, $num);
}

WordPress Version: 4.9

/**
 * Deprecated functionality to retrieve a list of the most active sites.
 *
 * @since MU (3.0.0)
 * @deprecated 3.0.0
 *
 * @param int  $num     Optional. Number of activate blogs to retrieve. Default 10.
 * @param bool $display Optional. Whether or not to display the most active blogs list. Default true.
 * @return array List of "most active" sites.
 */
function get_most_active_blogs($num = 10, $display = true)
{
    _deprecated_function(__FUNCTION__, '3.0.0');
    $blogs = get_blog_list(0, 'all', false);
    // $blog_id -> $details
    if (is_array($blogs)) {
        reset($blogs);
        $most_active = array();
        $blog_list = array();
        foreach ((array) $blogs as $key => $details) {
            $most_active[$details['blog_id']] = $details['postcount'];
            $blog_list[$details['blog_id']] = $details;
            // array_slice() removes keys!!
        }
        arsort($most_active);
        reset($most_active);
        $t = array();
        foreach ((array) $most_active as $key => $details) {
            $t[$key] = $blog_list[$key];
        }
        unset($most_active);
        $most_active = $t;
    }
    if ($display) {
        if (is_array($most_active)) {
            reset($most_active);
            foreach ((array) $most_active as $key => $details) {
                $url = esc_url('http://' . $details['domain'] . $details['path']);
                echo '<li>' . $details['postcount'] . " <a href='{$url}'>{$url}</a></li>";
            }
        }
    }
    return array_slice($most_active, 0, $num);
}

WordPress Version: 4.6

/**
 * Deprecated functionality to retrieve a list of the most active sites.
 *
 * @since MU
 * @deprecated 3.0.0
 *
 * @param int  $num     Optional. Number of activate blogs to retrieve. Default 10.
 * @param bool $display Optional. Whether or not to display the most active blogs list. Default true.
 * @return array List of "most active" sites.
 */
function get_most_active_blogs($num = 10, $display = true)
{
    _deprecated_function(__FUNCTION__, '3.0.0');
    $blogs = get_blog_list(0, 'all', false);
    // $blog_id -> $details
    if (is_array($blogs)) {
        reset($blogs);
        $most_active = array();
        $blog_list = array();
        foreach ((array) $blogs as $key => $details) {
            $most_active[$details['blog_id']] = $details['postcount'];
            $blog_list[$details['blog_id']] = $details;
            // array_slice() removes keys!!
        }
        arsort($most_active);
        reset($most_active);
        $t = array();
        foreach ((array) $most_active as $key => $details) {
            $t[$key] = $blog_list[$key];
        }
        unset($most_active);
        $most_active = $t;
    }
    if ($display) {
        if (is_array($most_active)) {
            reset($most_active);
            foreach ((array) $most_active as $key => $details) {
                $url = esc_url('http://' . $details['domain'] . $details['path']);
                echo '<li>' . $details['postcount'] . " <a href='{$url}'>{$url}</a></li>";
            }
        }
    }
    return array_slice($most_active, 0, $num);
}

WordPress Version: 4.5

/**
 * Deprecated functionality to retrieve a list of the most active sites.
 *
 * @since MU
 * @deprecated 3.0.0
 *
 * @param int  $num     Optional. Number of activate blogs to retrieve. Default 10.
 * @param bool $display Optional. Whether or not to display the most active blogs list. Default true.
 * @return array List of "most active" sites.
 */
function get_most_active_blogs($num = 10, $display = true)
{
    _deprecated_function(__FUNCTION__, '3.0');
    $blogs = get_blog_list(0, 'all', false);
    // $blog_id -> $details
    if (is_array($blogs)) {
        reset($blogs);
        $most_active = array();
        $blog_list = array();
        foreach ((array) $blogs as $key => $details) {
            $most_active[$details['blog_id']] = $details['postcount'];
            $blog_list[$details['blog_id']] = $details;
            // array_slice() removes keys!!
        }
        arsort($most_active);
        reset($most_active);
        $t = array();
        foreach ((array) $most_active as $key => $details) {
            $t[$key] = $blog_list[$key];
        }
        unset($most_active);
        $most_active = $t;
    }
    if ($display) {
        if (is_array($most_active)) {
            reset($most_active);
            foreach ((array) $most_active as $key => $details) {
                $url = esc_url('http://' . $details['domain'] . $details['path']);
                echo '<li>' . $details['postcount'] . " <a href='{$url}'>{$url}</a></li>";
            }
        }
    }
    return array_slice($most_active, 0, $num);
}

WordPress Version: 4.4

/**
 * Deprecated functionality to retrieve a list of the most active sites.
 *
 * @since MU
 * @deprecated 3.0.0
 *
 * @return array List of "most active" sites.
 */
function get_most_active_blogs($num = 10, $display = true)
{
    _deprecated_function(__FUNCTION__, '3.0');
    $blogs = get_blog_list(0, 'all', false);
    // $blog_id -> $details
    if (is_array($blogs)) {
        reset($blogs);
        $most_active = array();
        $blog_list = array();
        foreach ((array) $blogs as $key => $details) {
            $most_active[$details['blog_id']] = $details['postcount'];
            $blog_list[$details['blog_id']] = $details;
            // array_slice() removes keys!!
        }
        arsort($most_active);
        reset($most_active);
        $t = array();
        foreach ((array) $most_active as $key => $details) {
            $t[$key] = $blog_list[$key];
        }
        unset($most_active);
        $most_active = $t;
    }
    if ($display) {
        if (is_array($most_active)) {
            reset($most_active);
            foreach ((array) $most_active as $key => $details) {
                $url = esc_url('http://' . $details['domain'] . $details['path']);
                echo '<li>' . $details['postcount'] . " <a href='{$url}'>{$url}</a></li>";
            }
        }
    }
    return array_slice($most_active, 0, $num);
}

WordPress Version: 4.3

/**
 * @since MU
 * @deprecated 3.0.0
 * @deprecated No alternative available. For performance reasons this function is not recommended.
 */
function get_most_active_blogs($num = 10, $display = true)
{
    _deprecated_function(__FUNCTION__, '3.0');
    $blogs = get_blog_list(0, 'all', false);
    // $blog_id -> $details
    if (is_array($blogs)) {
        reset($blogs);
        $most_active = array();
        $blog_list = array();
        foreach ((array) $blogs as $key => $details) {
            $most_active[$details['blog_id']] = $details['postcount'];
            $blog_list[$details['blog_id']] = $details;
            // array_slice() removes keys!!
        }
        arsort($most_active);
        reset($most_active);
        $t = array();
        foreach ((array) $most_active as $key => $details) {
            $t[$key] = $blog_list[$key];
        }
        unset($most_active);
        $most_active = $t;
    }
    if ($display) {
        if (is_array($most_active)) {
            reset($most_active);
            foreach ((array) $most_active as $key => $details) {
                $url = esc_url('http://' . $details['domain'] . $details['path']);
                echo '<li>' . $details['postcount'] . " <a href='{$url}'>{$url}</a></li>";
            }
        }
    }
    return array_slice($most_active, 0, $num);
}

WordPress Version: 4.2

/**
 * @since MU
 * @deprecated 3.0.0
 * @deprecated No alternative available. For performance reasons this function is not recommended.
 */
function get_most_active_blogs($num = 10, $display = true)
{
    _deprecated_function(__FUNCTION__, '3.0');
    $blogs = get_blog_list(0, 'all', false);
    // $blog_id -> $details
    if (is_array($blogs)) {
        reset($blogs);
        $most_active = array();
        $blog_list = array();
        foreach ((array) $blogs as $key => $details) {
            $most_active[$details['blog_id']] = $details['postcount'];
            $blog_list[$details['blog_id']] = $details;
            // array_slice() removes keys!!
        }
        arsort($most_active);
        reset($most_active);
        $t = array();
        foreach ((array) $most_active as $key => $details) {
            $t[$key] = $blog_list[$key];
        }
        unset($most_active);
        $most_active = $t;
    }
    if ($display == true) {
        if (is_array($most_active)) {
            reset($most_active);
            foreach ((array) $most_active as $key => $details) {
                $url = esc_url('http://' . $details['domain'] . $details['path']);
                echo '<li>' . $details['postcount'] . " <a href='{$url}'>{$url}</a></li>";
            }
        }
    }
    return array_slice($most_active, 0, $num);
}

WordPress Version: 3.7

/**
 * @since MU
 * @deprecated 3.0.0
 * @deprecated No alternative available. For performance reasons this function is not recommended.
 */
function get_most_active_blogs($num = 10, $display = true)
{
    _deprecated_function(__FUNCTION__, '3.0');
    $blogs = get_blog_list(0, 'all', false);
    // $blog_id -> $details
    if (is_array($blogs)) {
        reset($blogs);
        foreach ((array) $blogs as $key => $details) {
            $most_active[$details['blog_id']] = $details['postcount'];
            $blog_list[$details['blog_id']] = $details;
            // array_slice() removes keys!!
        }
        arsort($most_active);
        reset($most_active);
        foreach ((array) $most_active as $key => $details) {
            $t[$key] = $blog_list[$key];
        }
        unset($most_active);
        $most_active = $t;
    }
    if ($display == true) {
        if (is_array($most_active)) {
            reset($most_active);
            foreach ((array) $most_active as $key => $details) {
                $url = esc_url('http://' . $details['domain'] . $details['path']);
                echo '<li>' . $details['postcount'] . " <a href='{$url}'>{$url}</a></li>";
            }
        }
    }
    return array_slice($most_active, 0, $num);
}