Using WordPress ‘install_dashboard()’ PHP function

The install_dashboard() WordPress PHP function displays the Featured tab of the Add Plugins screen.

Usage

To use the install_dashboard() function, simply call it within your PHP code:

install_dashboard();

Parameters

The install_dashboard() function has no parameters.

More information

See WordPress Developer Resources: install_dashboard

Examples

This example creates a custom admin page and uses the install_dashboard() function to display the Featured tab of Add Plugins screen on that page.

// Add a custom admin page
add_action('admin_menu', 'my_custom_admin_menu');

function my_custom_admin_menu() {
    add_menu_page('My Custom Page', 'My Custom Page', 'manage_options', 'my-custom-page', 'my_custom_page_callback');
}

// Callback function to display the content of the custom admin page
function my_custom_page_callback() {
    // Call the install_dashboard function to display the Featured tab of Add Plugins screen
    install_dashboard();
}

This example displays the Featured tab of Add Plugins screen after a custom action has been completed, like activating a plugin.

// Hook into the 'activated_plugin' action
add_action('activated_plugin', 'show_install_dashboard_after_activation');

function show_install_dashboard_after_activation() {
    // Display the Featured tab of Add Plugins screen
    install_dashboard();
}

This example creates a custom theme settings page and uses the install_dashboard() function to display the Featured tab of Add Plugins screen on that page.

// Add a custom theme settings page
add_action('admin_menu', 'my_custom_theme_settings');

function my_custom_theme_settings() {
    add_theme_page('My Custom Theme Settings', 'My Custom Theme Settings', 'edit_theme_options', 'my-custom-theme-settings', 'my_custom_theme_settings_callback');
}

// Callback function to display the content of the custom theme settings page
function my_custom_theme_settings_callback() {
    // Call the install_dashboard function to display the Featured tab of Add Plugins screen
    install_dashboard();
}

This example displays the Featured tab of Add Plugins screen after a plugin update has been completed.

// Hook into the 'upgrader_process_complete' action
add_action('upgrader_process_complete', 'show_install_dashboard_after_plugin_update', 10, 2);

function show_install_dashboard_after_plugin_update($upgrader_object, $options) {
    // Check if the action is a plugin update
    if ($options['action'] == 'update' && $options['type'] == 'plugin') {
        // Display the Featured tab of Add Plugins screen
        install_dashboard();
    }
}