The manage_users_extra_tablenav WordPress PHP action allows you to add custom content or functionality immediately after the closing “actions” div in the tablenav for the users list table.
Usage
add_action('manage_users_extra_tablenav', 'your_function_name', 10, 1); function your_function_name($which) { // your custom code here return $which; }
Parameters
- $which (string): The location of the extra table nav markup: ‘top’ or ‘bottom’.
More information
See WordPress Developer Resources: manage_users_extra_tablenav
Examples
Add a custom button to the top of the users list table
In this example, we will add a custom button to the top of the users list table.
add_action('manage_users_extra_tablenav', 'add_custom_button', 10, 1); function add_custom_button($which) { if ($which == 'top') { echo '<input type="submit" name="custom_button" class="button action" value="Custom Button">'; } }
Add a custom dropdown filter to the bottom of the users list table
In this example, we will add a custom dropdown filter to the bottom of the users list table.
add_action('manage_users_extra_tablenav', 'add_custom_dropdown', 10, 1); function add_custom_dropdown($which) { if ($which == 'bottom') { echo '<select name="custom_filter">'; echo '<option value="option1">Option 1</option>'; echo '<option value="option2">Option 2</option>'; echo '</select>'; } }
Add text to the top and bottom of the users list table
In this example, we will add text to both the top and bottom of the users list table.
add_action('manage_users_extra_tablenav', 'add_custom_text', 10, 1); function add_custom_text($which) { if ($which == 'top') { echo '<p>Custom text at the top</p>'; } elseif ($which == 'bottom') { echo '<p>Custom text at the bottom</p>'; } }
Add a custom search box to the top of the users list table
In this example, we will add a custom search box to the top of the users list table.
add_action('manage_users_extra_tablenav', 'add_custom_search_box', 10, 1); function add_custom_search_box($which) { if ($which == 'top') { echo '<input type="search" name="custom_search" placeholder="Custom Search">'; } }
Add a custom message to the bottom of the users list table
In this example, we will add a custom message to the bottom of the users list table.
add_action('manage_users_extra_tablenav', 'add_custom_message', 10, 1); function add_custom_message($which) { if ($which == 'bottom') { echo '<p>Important: Please do not delete admin users.</p>'; } }