wp_ajax_search_install_plugins

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

WordPress Version: 6.3

/**
 * Handles searching plugins to install via AJAX.
 *
 * @since 4.6.0
 */
function wp_ajax_search_install_plugins()
{
    check_ajax_referer('updates');
    $pagenow = isset($_POST['pagenow']) ? sanitize_key($_POST['pagenow']) : '';
    if ('plugin-install-network' === $pagenow || 'plugin-install' === $pagenow) {
        set_current_screen($pagenow);
    }
    /** @var WP_Plugin_Install_List_Table $wp_list_table */
    $wp_list_table = _get_list_table('WP_Plugin_Install_List_Table', array('screen' => get_current_screen()));
    $status = array();
    if (!$wp_list_table->ajax_user_can()) {
        $status['errorMessage'] = __('Sorry, you are not allowed to manage plugins for this site.');
        wp_send_json_error($status);
    }
    // Set the correct requester, so pagination works.
    $_SERVER['REQUEST_URI'] = add_query_arg(array_diff_key($_POST, array('_ajax_nonce' => null, 'action' => null)), network_admin_url('plugin-install.php', 'relative'));
    $wp_list_table->prepare_items();
    ob_start();
    $wp_list_table->display();
    $status['count'] = (int) $wp_list_table->get_pagination_arg('total_items');
    $status['items'] = ob_get_clean();
    wp_send_json_success($status);
}

WordPress Version: 4.6

/**
 * Ajax handler for searching plugins to install.
 *
 * @since 4.6.0
 */
function wp_ajax_search_install_plugins()
{
    check_ajax_referer('updates');
    $pagenow = isset($_POST['pagenow']) ? sanitize_key($_POST['pagenow']) : '';
    if ('plugin-install-network' === $pagenow || 'plugin-install' === $pagenow) {
        set_current_screen($pagenow);
    }
    /** @var WP_Plugin_Install_List_Table $wp_list_table */
    $wp_list_table = _get_list_table('WP_Plugin_Install_List_Table', array('screen' => get_current_screen()));
    $status = array();
    if (!$wp_list_table->ajax_user_can()) {
        $status['errorMessage'] = __('Sorry, you are not allowed to manage plugins for this site.');
        wp_send_json_error($status);
    }
    // Set the correct requester, so pagination works.
    $_SERVER['REQUEST_URI'] = add_query_arg(array_diff_key($_POST, array('_ajax_nonce' => null, 'action' => null)), network_admin_url('plugin-install.php', 'relative'));
    $wp_list_table->prepare_items();
    ob_start();
    $wp_list_table->display();
    $status['count'] = (int) $wp_list_table->get_pagination_arg('total_items');
    $status['items'] = ob_get_clean();
    wp_send_json_success($status);
}