This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
restrict_manage_users action
Fires just before the closing div containing the bulk role-change controls in the Users list table.
To use the restrict_manage_users action, first you have to register it using add_action. You can write this code into functions.php
of your activated theme or in a custom WordPress Plugin.
We at WePlugins always prefer to create a custom WordPress Plugin while using hooks so nothing breaks when you update your WordPress Theme in the future.
In the below live example, we have defined a function execute_on_restrict_manage_users_event
which takes 1 parameter and we registered it using add_action. The first parameter restrict_manage_users
is the name of the hook, the second parameter execute_on_restrict_manage_users_event
is the name of the function which needs to be called, the third parameter is the priority of calling the hook if the same hook is used multiple times, and the last parameter is the number of arguments (if any) to be passed in the registered function.
Sometimes, you have to remove a registered hook so you can use remove_action to remove restrict_manage_users
action.
Parameters
- $which: (string) The location of the extra table nav markup: ‘top’ or ‘bottom’.
Below the 1 parameter is required to use this hook.
Live Examples
Example 1: Adding Custom Functionality to User Management
This example shows how to add custom functionality to the user management screen.
function weplugins_execute_on_restrict_manage_users_event($which) { // Code to execute custom functionality } add_action("restrict_manage_users", "weplugins_execute_on_restrict_manage_users_event", 10, 1);
Example 2: Removing Custom Functionality from User Management
To remove the previously added custom functionality, use the following code:
remove_action("restrict_manage_users", "weplugins_execute_on_restrict_manage_users_event", 10, 1);
Example 3: Adding Filters to User Management
In this example, we add filters to the user management screen to allow for enhanced user sorting and searching.
function weplugins_add_custom_user_filters($which) { // Code to add custom filters } add_action("restrict_manage_users", "weplugins_add_custom_user_filters", 10, 1);
Contact Us
If you’re having any trouble using this hook or need customization, please contact us and we’d be happy to assist you.
Explore the latest in WordPress
Trying to stay on top of it all? Get the best tools, resources and inspiration sent to your inbox every Wednesday.