admin 管理员组

文章数量: 1184232

I use:

add_filter( 'user_has_cap','my_function', 10, 3 ); 

In user list to allow users to edit only a specific list of users with a meta user identical to a current user connected.

To get the list of users I use get_users($args); but this triggers an infinite loop.

I guess somewhere get_users calls user_has_cap again.

I try to remove_filter before get_users($args);, this works but the filter only works the first time in my user list.

I try to add add_filter( 'user_has_cap','my_function', 10, 3 ); after get_users($args); but again this triggers an infinite loop.

remove_filter( 'user_has_cap', __FUNCTION__ );
$user_ids = get_users($args);
add_filter( 'user_has_cap', 'author_cap_filter', 10, 3 );

My other solution is to write a SQL query with $wpdb->get_results.

本文标签:

Error[2]: Invalid argument supplied for foreach(), File: /www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm, Line: 58
File: /www/wwwroot/roclinux.cn/tmp/route_read.php, Line: 205, include(/www/wwwroot/roclinux.cn/tmp/view_template_quzhiwa_htm_read.htm)
File: /www/wwwroot/roclinux.cn/tmp/index.inc.php, Line: 129, include(/www/wwwroot/roclinux.cn/tmp/route_read.php)
File: /www/wwwroot/roclinux.cn/index.php, Line: 29, include(/www/wwwroot/roclinux.cn/tmp/index.inc.php)