Using WordPress ‘manage_sites_extra_tablenav’ PHP action

The manage_sites_extra_tablenav WordPress action fires immediately after the closing “actions” div in the tablenav for the Multisite sites list table.

Usage

add_action('manage_sites_extra_tablenav', 'your_custom_function', 10, 1);

function your_custom_function($which) {
    // Your custom code here
}

Parameters

  • $which (string): The location of the extra table nav markup: ‘top’ or ‘bottom’.

More information

See WordPress Developer Resources: manage_sites_extra_tablenav

Examples

Adding a button to the top of the sites list table

This example adds a custom button to the top of the sites list table.

add_action('manage_sites_extra_tablenav', 'add_custom_button', 10, 1);

function add_custom_button($which) {
    if ($which == 'top') {
        echo '<input type="submit" name="my_custom_button" class="button" value="Custom Button">';
    }
}

Adding a select dropdown to the bottom of the sites list table

This example adds a custom select dropdown to the bottom of the sites list table.

add_action('manage_sites_extra_tablenav', 'add_custom_select', 10, 1);

function add_custom_select($which) {
    if ($which == 'bottom') {
        echo '<select name="custom_filter"><option value="">Select Filter</option></select>';
    }
}

Displaying text at the top of the sites list table

This example displays a custom message at the top of the sites list table.

add_action('manage_sites_extra_tablenav', 'display_custom_text', 10, 1);

function display_custom_text($which) {
    if ($which == 'top') {
        echo '<p>**Note:** Custom message displayed here.</p>';
    }
}

Adding a search box at the bottom of the sites list table

This example adds a custom search box at the bottom of the sites list table.

add_action('manage_sites_extra_tablenav', 'add_custom_search', 10, 1);

function add_custom_search($which) {
    if ($which == 'bottom') {
        echo '<input type="search" name="custom_search" placeholder="Search Sites">';
    }
}

Displaying a notice at the bottom of the sites list table

This example displays a custom notice at the bottom of the sites list table.

add_action('manage_sites_extra_tablenav', 'display_custom_notice', 10, 1);

function display_custom_notice($which) {
    if ($which == 'bottom') {
        echo '<p>**Important:** Please verify your site information regularly.</p>';
    }
}