Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to filter views_edit in user list table?

Tags:

wordpress

The following is a screenshot of the users list table in the dashboard. I'd like to customize highlighted part:

enter image description here

I know how do it in the posts list table using the method explained in this WordPress Answer.

I tried to use filter views_edit-user but nothing happened. I also tried to Google it but it seems this filter doesn't have documentation or is not really a WordPress filter.

How to customize that admin section using add_action or add_filter?

like image 255
Emman Z Avatar asked Mar 08 '13 14:03

Emman Z


1 Answers

The hook for that screen is based on 'views_' . $this->screen->id, so it should be:

add_filter( 'views_users', 'modify_views_users_so_15295853' );

function modify_views_users_so_15295853( $views ) 
{
    // Manipulate $views

    return $views;
}

The content of $views in my system is:

Array
(
    [all] => <a href='users.php' class="current">All <span class="count">(7)</span></a>
    [administrator] => <a href='users.php?role=administrator'>Administrator <span class="count">(1)</span></a>
    [editor] => <a href='users.php?role=editor'>Editor <span class="count">(1)</span></a>
    [subscriber] => <a href='users.php?role=subscriber'>Subscriber <span class="count">(5)</span></a>
)
like image 191
brasofilo Avatar answered Nov 14 '22 19:11

brasofilo