wp_dashboard_plugins_output

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

WordPress Version: 6.3

/**
 * Display plugins text for the WordPress news widget.
 *
 * @since 2.5.0
 * @deprecated 4.8.0
 *
 * @param string $rss  The RSS feed URL.
 * @param array  $args Array of arguments for this RSS feed.
 */
function wp_dashboard_plugins_output($rss, $args = array())
{
    _deprecated_function(__FUNCTION__, '4.8.0');
    // Plugin feeds plus link to install them.
    $popular = fetch_feed($args['url']['popular']);
    if (false === $plugin_slugs = get_transient('plugin_slugs')) {
        $plugin_slugs = array_keys(get_plugins());
        set_transient('plugin_slugs', $plugin_slugs, DAY_IN_SECONDS);
    }
    echo '<ul>';
    foreach (array($popular) as $feed) {
        if (is_wp_error($feed) || !$feed->get_item_quantity()) {
            continue;
        }
        $items = $feed->get_items(0, 5);
        // Pick a random, non-installed plugin.
        while (true) {
            // Abort this foreach loop iteration if there's no plugins left of this type.
            if (0 === count($items)) {
                continue 2;
            }
            $item_key = array_rand($items);
            $item = $items[$item_key];
            list($link, $frag) = explode('#', $item->get_link());
            $link = esc_url($link);
            if (preg_match('|/([^/]+?)/?$|', $link, $matches)) {
                $slug = $matches[1];
            } else {
                unset($items[$item_key]);
                continue;
            }
            // Is this random plugin's slug already installed? If so, try again.
            reset($plugin_slugs);
            foreach ($plugin_slugs as $plugin_slug) {
                if (str_starts_with($plugin_slug, $slug)) {
                    unset($items[$item_key]);
                    continue 2;
                }
            }
            // If we get to this point, then the random plugin isn't installed and we can stop the while().
            break;
        }
        // Eliminate some common badly formed plugin descriptions.
        while (null !== ($item_key = array_rand($items)) && str_contains($items[$item_key]->get_description(), 'Plugin Name:')) {
            unset($items[$item_key]);
        }
        if (!isset($items[$item_key])) {
            continue;
        }
        $raw_title = $item->get_title();
        $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
        echo '<li class="dashboard-news-plugin"><span>' . __('Popular Plugin') . ':</span> ' . esc_html($raw_title) . '&nbsp;<a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' . esc_attr(sprintf(_x('Install %s', 'plugin'), $raw_title)) . '">(' . __('Install') . ')</a></li>';
        $feed->__destruct();
        unset($feed);
    }
    echo '</ul>';
}

WordPress Version: 5.5

/**
 * Display plugins text for the WordPress news widget.
 *
 * @since 2.5.0
 * @deprecated 4.8.0
 *
 * @param string $rss  The RSS feed URL.
 * @param array  $args Array of arguments for this RSS feed.
 */
function wp_dashboard_plugins_output($rss, $args = array())
{
    _deprecated_function(__FUNCTION__, '4.8.0');
    // Plugin feeds plus link to install them.
    $popular = fetch_feed($args['url']['popular']);
    if (false === $plugin_slugs = get_transient('plugin_slugs')) {
        $plugin_slugs = array_keys(get_plugins());
        set_transient('plugin_slugs', $plugin_slugs, DAY_IN_SECONDS);
    }
    echo '<ul>';
    foreach (array($popular) as $feed) {
        if (is_wp_error($feed) || !$feed->get_item_quantity()) {
            continue;
        }
        $items = $feed->get_items(0, 5);
        // Pick a random, non-installed plugin.
        while (true) {
            // Abort this foreach loop iteration if there's no plugins left of this type.
            if (0 === count($items)) {
                continue 2;
            }
            $item_key = array_rand($items);
            $item = $items[$item_key];
            list($link, $frag) = explode('#', $item->get_link());
            $link = esc_url($link);
            if (preg_match('|/([^/]+?)/?$|', $link, $matches)) {
                $slug = $matches[1];
            } else {
                unset($items[$item_key]);
                continue;
            }
            // Is this random plugin's slug already installed? If so, try again.
            reset($plugin_slugs);
            foreach ($plugin_slugs as $plugin_slug) {
                if ($slug == substr($plugin_slug, 0, strlen($slug))) {
                    unset($items[$item_key]);
                    continue 2;
                }
            }
            // If we get to this point, then the random plugin isn't installed and we can stop the while().
            break;
        }
        // Eliminate some common badly formed plugin descriptions.
        while (null !== ($item_key = array_rand($items)) && false !== strpos($items[$item_key]->get_description(), 'Plugin Name:')) {
            unset($items[$item_key]);
        }
        if (!isset($items[$item_key])) {
            continue;
        }
        $raw_title = $item->get_title();
        $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
        echo '<li class="dashboard-news-plugin"><span>' . __('Popular Plugin') . ':</span> ' . esc_html($raw_title) . '&nbsp;<a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' . esc_attr(sprintf(_x('Install %s', 'plugin'), $raw_title)) . '">(' . __('Install') . ')</a></li>';
        $feed->__destruct();
        unset($feed);
    }
    echo '</ul>';
}

WordPress Version: 5.4

/**
 * Display plugins text for the WordPress news widget.
 *
 * @since 2.5.0
 * @deprecated 4.8.0
 *
 * @param string $rss  The RSS feed URL.
 * @param array  $args Array of arguments for this RSS feed.
 */
function wp_dashboard_plugins_output($rss, $args = array())
{
    _deprecated_function(__FUNCTION__, '4.8.0');
    // Plugin feeds plus link to install them.
    $popular = fetch_feed($args['url']['popular']);
    if (false === $plugin_slugs = get_transient('plugin_slugs')) {
        $plugin_slugs = array_keys(get_plugins());
        set_transient('plugin_slugs', $plugin_slugs, DAY_IN_SECONDS);
    }
    echo '<ul>';
    foreach (array($popular) as $feed) {
        if (is_wp_error($feed) || !$feed->get_item_quantity()) {
            continue;
        }
        $items = $feed->get_items(0, 5);
        // Pick a random, non-installed plugin.
        while (true) {
            // Abort this foreach loop iteration if there's no plugins left of this type.
            if (0 == count($items)) {
                continue 2;
            }
            $item_key = array_rand($items);
            $item = $items[$item_key];
            list($link, $frag) = explode('#', $item->get_link());
            $link = esc_url($link);
            if (preg_match('|/([^/]+?)/?$|', $link, $matches)) {
                $slug = $matches[1];
            } else {
                unset($items[$item_key]);
                continue;
            }
            // Is this random plugin's slug already installed? If so, try again.
            reset($plugin_slugs);
            foreach ($plugin_slugs as $plugin_slug) {
                if ($slug == substr($plugin_slug, 0, strlen($slug))) {
                    unset($items[$item_key]);
                    continue 2;
                }
            }
            // If we get to this point, then the random plugin isn't installed and we can stop the while().
            break;
        }
        // Eliminate some common badly formed plugin descriptions.
        while (null !== ($item_key = array_rand($items)) && false !== strpos($items[$item_key]->get_description(), 'Plugin Name:')) {
            unset($items[$item_key]);
        }
        if (!isset($items[$item_key])) {
            continue;
        }
        $raw_title = $item->get_title();
        $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
        echo '<li class="dashboard-news-plugin"><span>' . __('Popular Plugin') . ':</span> ' . esc_html($raw_title) . '&nbsp;<a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' . esc_attr(sprintf(__('Install %s'), $raw_title)) . '">(' . __('Install') . ')</a></li>';
        $feed->__destruct();
        unset($feed);
    }
    echo '</ul>';
}

WordPress Version: 4.8

/**
 * Display plugins text for the WordPress news widget.
 *
 * @since 2.5.0
 * @deprecated 4.8.0
 *
 * @param string $rss  The RSS feed URL.
 * @param array  $args Array of arguments for this RSS feed.
 */
function wp_dashboard_plugins_output($rss, $args = array())
{
    _deprecated_function(__FUNCTION__, '4.8.0');
    // Plugin feeds plus link to install them
    $popular = fetch_feed($args['url']['popular']);
    if (false === $plugin_slugs = get_transient('plugin_slugs')) {
        $plugin_slugs = array_keys(get_plugins());
        set_transient('plugin_slugs', $plugin_slugs, DAY_IN_SECONDS);
    }
    echo '<ul>';
    foreach (array($popular) as $feed) {
        if (is_wp_error($feed) || !$feed->get_item_quantity()) {
            continue;
        }
        $items = $feed->get_items(0, 5);
        // Pick a random, non-installed plugin
        while (true) {
            // Abort this foreach loop iteration if there's no plugins left of this type
            if (0 == count($items)) {
                continue 2;
            }
            $item_key = array_rand($items);
            $item = $items[$item_key];
            list($link, $frag) = explode('#', $item->get_link());
            $link = esc_url($link);
            if (preg_match('|/([^/]+?)/?$|', $link, $matches)) {
                $slug = $matches[1];
            } else {
                unset($items[$item_key]);
                continue;
            }
            // Is this random plugin's slug already installed? If so, try again.
            reset($plugin_slugs);
            foreach ($plugin_slugs as $plugin_slug) {
                if ($slug == substr($plugin_slug, 0, strlen($slug))) {
                    unset($items[$item_key]);
                    continue 2;
                }
            }
            // If we get to this point, then the random plugin isn't installed and we can stop the while().
            break;
        }
        // Eliminate some common badly formed plugin descriptions
        while (null !== ($item_key = array_rand($items)) && false !== strpos($items[$item_key]->get_description(), 'Plugin Name:')) {
            unset($items[$item_key]);
        }
        if (!isset($items[$item_key])) {
            continue;
        }
        $raw_title = $item->get_title();
        $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
        echo '<li class="dashboard-news-plugin"><span>' . __('Popular Plugin') . ':</span> ' . esc_html($raw_title) . '&nbsp;<a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' . esc_attr(sprintf(__('Install %s'), $raw_title)) . '">(' . __('Install') . ')</a></li>';
        $feed->__destruct();
        unset($feed);
    }
    echo '</ul>';
}

WordPress Version: 4.5

/**
 * Display plugins text for the WordPress news widget.
 *
 * @since 2.5.0
 *
 * @param string $rss  The RSS feed URL.
 * @param array  $args Array of arguments for this RSS feed.
 */
function wp_dashboard_plugins_output($rss, $args = array())
{
    // Plugin feeds plus link to install them
    $popular = fetch_feed($args['url']['popular']);
    if (false === $plugin_slugs = get_transient('plugin_slugs')) {
        $plugin_slugs = array_keys(get_plugins());
        set_transient('plugin_slugs', $plugin_slugs, DAY_IN_SECONDS);
    }
    echo '<ul>';
    foreach (array($popular) as $feed) {
        if (is_wp_error($feed) || !$feed->get_item_quantity()) {
            continue;
        }
        $items = $feed->get_items(0, 5);
        // Pick a random, non-installed plugin
        while (true) {
            // Abort this foreach loop iteration if there's no plugins left of this type
            if (0 == count($items)) {
                continue 2;
            }
            $item_key = array_rand($items);
            $item = $items[$item_key];
            list($link, $frag) = explode('#', $item->get_link());
            $link = esc_url($link);
            if (preg_match('|/([^/]+?)/?$|', $link, $matches)) {
                $slug = $matches[1];
            } else {
                unset($items[$item_key]);
                continue;
            }
            // Is this random plugin's slug already installed? If so, try again.
            reset($plugin_slugs);
            foreach ($plugin_slugs as $plugin_slug) {
                if ($slug == substr($plugin_slug, 0, strlen($slug))) {
                    unset($items[$item_key]);
                    continue 2;
                }
            }
            // If we get to this point, then the random plugin isn't installed and we can stop the while().
            break;
        }
        // Eliminate some common badly formed plugin descriptions
        while (null !== ($item_key = array_rand($items)) && false !== strpos($items[$item_key]->get_description(), 'Plugin Name:')) {
            unset($items[$item_key]);
        }
        if (!isset($items[$item_key])) {
            continue;
        }
        $raw_title = $item->get_title();
        $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
        echo '<li class="dashboard-news-plugin"><span>' . __('Popular Plugin') . ':</span> ' . esc_html($raw_title) . '&nbsp;<a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' . esc_attr(sprintf(__('Install %s'), $raw_title)) . '">(' . __('Install') . ')</a></li>';
        $feed->__destruct();
        unset($feed);
    }
    echo '</ul>';
}

WordPress Version: 4.0

/**
 * Display plugins text for the WordPress news widget.
 *
 * @since 2.5.0
 */
function wp_dashboard_plugins_output($rss, $args = array())
{
    // Plugin feeds plus link to install them
    $popular = fetch_feed($args['url']['popular']);
    if (false === $plugin_slugs = get_transient('plugin_slugs')) {
        $plugin_slugs = array_keys(get_plugins());
        set_transient('plugin_slugs', $plugin_slugs, DAY_IN_SECONDS);
    }
    echo '<ul>';
    foreach (array($popular) as $feed) {
        if (is_wp_error($feed) || !$feed->get_item_quantity()) {
            continue;
        }
        $items = $feed->get_items(0, 5);
        // Pick a random, non-installed plugin
        while (true) {
            // Abort this foreach loop iteration if there's no plugins left of this type
            if (0 == count($items)) {
                continue 2;
            }
            $item_key = array_rand($items);
            $item = $items[$item_key];
            list($link, $frag) = explode('#', $item->get_link());
            $link = esc_url($link);
            if (preg_match('|/([^/]+?)/?$|', $link, $matches)) {
                $slug = $matches[1];
            } else {
                unset($items[$item_key]);
                continue;
            }
            // Is this random plugin's slug already installed? If so, try again.
            reset($plugin_slugs);
            foreach ($plugin_slugs as $plugin_slug) {
                if ($slug == substr($plugin_slug, 0, strlen($slug))) {
                    unset($items[$item_key]);
                    continue 2;
                }
            }
            // If we get to this point, then the random plugin isn't installed and we can stop the while().
            break;
        }
        // Eliminate some common badly formed plugin descriptions
        while (null !== ($item_key = array_rand($items)) && false !== strpos($items[$item_key]->get_description(), 'Plugin Name:')) {
            unset($items[$item_key]);
        }
        if (!isset($items[$item_key])) {
            continue;
        }
        $title = esc_html($item->get_title());
        $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
        echo "<li class='dashboard-news-plugin'><span>" . __('Popular Plugin') . ":</span> <a href='{$link}' class='dashboard-news-plugin-link'>{$title}</a>&nbsp;<span>(<a href='{$ilink}' class='thickbox' title='{$title}'>" . __('Install') . "</a>)</span></li>";
        $feed->__destruct();
        unset($feed);
    }
    echo '</ul>';
}

WordPress Version: 3.9

/**
 * Display plugins text for the WordPress news widget.
 *
 * @since 2.5.0
 */
function wp_dashboard_plugins_output($rss, $args = array())
{
    // Plugin feeds plus link to install them
    $popular = fetch_feed($args['url']['popular']);
    if (false === $plugin_slugs = get_transient('plugin_slugs')) {
        $plugin_slugs = array_keys(get_plugins());
        set_transient('plugin_slugs', $plugin_slugs, DAY_IN_SECONDS);
    }
    echo '<ul>';
    foreach (array('popular' => __('Popular Plugin')) as $feed => $label) {
        if (is_wp_error(${$feed}) || !${$feed}->get_item_quantity()) {
            continue;
        }
        $items = ${$feed}->get_items(0, 5);
        // Pick a random, non-installed plugin
        while (true) {
            // Abort this foreach loop iteration if there's no plugins left of this type
            if (0 == count($items)) {
                continue 2;
            }
            $item_key = array_rand($items);
            $item = $items[$item_key];
            list($link, $frag) = explode('#', $item->get_link());
            $link = esc_url($link);
            if (preg_match('|/([^/]+?)/?$|', $link, $matches)) {
                $slug = $matches[1];
            } else {
                unset($items[$item_key]);
                continue;
            }
            // Is this random plugin's slug already installed? If so, try again.
            reset($plugin_slugs);
            foreach ($plugin_slugs as $plugin_slug) {
                if ($slug == substr($plugin_slug, 0, strlen($slug))) {
                    unset($items[$item_key]);
                    continue 2;
                }
            }
            // If we get to this point, then the random plugin isn't installed and we can stop the while().
            break;
        }
        // Eliminate some common badly formed plugin descriptions
        while (null !== ($item_key = array_rand($items)) && false !== strpos($items[$item_key]->get_description(), 'Plugin Name:')) {
            unset($items[$item_key]);
        }
        if (!isset($items[$item_key])) {
            continue;
        }
        $title = esc_html($item->get_title());
        $description = esc_html(strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'))));
        $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
        echo "<li class='dashboard-news-plugin'><span>{$label}:</span> <a href='{$link}' class='dashboard-news-plugin-link'>{$title}</a>&nbsp;<span>(<a href='{$ilink}' class='thickbox' title='{$title}'>" . __('Install') . "</a>)</span></li>";
        ${$feed}->__destruct();
        unset(${$feed});
    }
    echo '</ul>';
}

WordPress Version: 3.8

/**
 * Display plugins text for the WordPress news widget.
 *
 * @since 2.5.0
 */
function wp_dashboard_plugins_output($rss, $args = array())
{
    // Plugin feeds plus link to install them
    $popular = fetch_feed($args['url']['popular']);
    if (false === $plugin_slugs = get_transient('plugin_slugs')) {
        $plugin_slugs = array_keys(get_plugins());
        set_transient('plugin_slugs', $plugin_slugs, DAY_IN_SECONDS);
    }
    echo '<ul>';
    foreach (array('popular' => __('Popular Plugin')) as $feed => $label) {
        if (is_wp_error(${$feed}) || !${$feed}->get_item_quantity()) {
            continue;
        }
        $items = ${$feed}->get_items(0, 5);
        // Pick a random, non-installed plugin
        while (true) {
            // Abort this foreach loop iteration if there's no plugins left of this type
            if (0 == count($items)) {
                continue 2;
            }
            $item_key = array_rand($items);
            $item = $items[$item_key];
            list($link, $frag) = explode('#', $item->get_link());
            $link = esc_url($link);
            if (preg_match('|/([^/]+?)/?$|', $link, $matches)) {
                $slug = $matches[1];
            } else {
                unset($items[$item_key]);
                continue;
            }
            // Is this random plugin's slug already installed? If so, try again.
            reset($plugin_slugs);
            foreach ($plugin_slugs as $plugin_slug) {
                if ($slug == substr($plugin_slug, 0, strlen($slug))) {
                    unset($items[$item_key]);
                    continue 2;
                }
            }
            // If we get to this point, then the random plugin isn't installed and we can stop the while().
            break;
        }
        // Eliminate some common badly formed plugin descriptions
        while (null !== ($item_key = array_rand($items)) && false !== strpos($items[$item_key]->get_description(), 'Plugin Name:')) {
            unset($items[$item_key]);
        }
        if (!isset($items[$item_key])) {
            continue;
        }
        $title = esc_html($item->get_title());
        $description = esc_html(strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'))));
        $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
        echo "<li class='dashboard-news-plugin'><span>{$label}:</span> <a href='{$link}' class='dashboard-news-plugin-link'>{$title}</a></h5>&nbsp;<span>(<a href='{$ilink}' class='thickbox' title='{$title}'>" . __('Install') . "</a>)</span></li>";
        ${$feed}->__destruct();
        unset(${$feed});
    }
    echo '</ul>';
}

WordPress Version: 3.7

/**
 * Display plugins most popular, newest plugins, and recently updated widget text.
 *
 * @since 2.5.0
 */
function wp_dashboard_plugins_output()
{
    $popular = fetch_feed('http://wordpress.org/plugins/rss/browse/popular/');
    $new = fetch_feed('http://wordpress.org/plugins/rss/browse/new/');
    if (false === $plugin_slugs = get_transient('plugin_slugs')) {
        $plugin_slugs = array_keys(get_plugins());
        set_transient('plugin_slugs', $plugin_slugs, DAY_IN_SECONDS);
    }
    foreach (array('popular' => __('Most Popular'), 'new' => __('Newest Plugins')) as $feed => $label) {
        if (is_wp_error(${$feed}) || !${$feed}->get_item_quantity()) {
            continue;
        }
        $items = ${$feed}->get_items(0, 5);
        // Pick a random, non-installed plugin
        while (true) {
            // Abort this foreach loop iteration if there's no plugins left of this type
            if (0 == count($items)) {
                continue 2;
            }
            $item_key = array_rand($items);
            $item = $items[$item_key];
            list($link, $frag) = explode('#', $item->get_link());
            $link = esc_url($link);
            if (preg_match('|/([^/]+?)/?$|', $link, $matches)) {
                $slug = $matches[1];
            } else {
                unset($items[$item_key]);
                continue;
            }
            // Is this random plugin's slug already installed? If so, try again.
            reset($plugin_slugs);
            foreach ($plugin_slugs as $plugin_slug) {
                if ($slug == substr($plugin_slug, 0, strlen($slug))) {
                    unset($items[$item_key]);
                    continue 2;
                }
            }
            // If we get to this point, then the random plugin isn't installed and we can stop the while().
            break;
        }
        // Eliminate some common badly formed plugin descriptions
        while (null !== ($item_key = array_rand($items)) && false !== strpos($items[$item_key]->get_description(), 'Plugin Name:')) {
            unset($items[$item_key]);
        }
        if (!isset($items[$item_key])) {
            continue;
        }
        $title = esc_html($item->get_title());
        $description = esc_html(strip_tags(@html_entity_decode($item->get_description(), ENT_QUOTES, get_option('blog_charset'))));
        $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
        echo "<h4>{$label}</h4>\n";
        echo "<h5><a href='{$link}'>{$title}</a></h5>&nbsp;<span>(<a href='{$ilink}' class='thickbox' title='{$title}'>" . __('Install') . "</a>)</span>\n";
        echo "<p>{$description}</p>\n";
        ${$feed}->__destruct();
        unset(${$feed});
    }
}