Change the functionality of wordpress users module in admin

I want to restrict wordpress admin to view all users in user list.

For say, I have created custom roles (company users, employee). A company user type role can have multiple employees.

Read More

I want wordpress admin to only view company users.

I got, args in function prepare_items() inside WP_Users_List_Table class can filter this. So have tried to override this in my theme’s functions.php.

function my_prepare_items(){

    //my custom code goes here

}
add_action( 'prepare_items', 'my_prepare_items' );

But it’s not working. How and where I can override this functionality without touching core wordpress methods?

EDIT :
This I want in admin UI.

Thanks in advance.

Related posts

Leave a Reply