Skip to content

Instantly share code, notes, and snippets.



Created Apr 4, 2014
What would you like to do?
// user role display test
global $wp_roles;
$all_roles = $wp_roles->roles;
echo "<pre>";
print_r( $wp_roles );
echo "</pre>";
ditable_roles = apply_filters('editable_roles', $all_roles);
echo "<pre>";
print_r( $editable_roles );
echo "</pre>";
//return $editable_roles;
$wp_user_search = new WP_User_Query( array( 'role' => 'webmaster' ) );
$admins = $wp_user_search->get_results();
$admin_ids = array();
foreach($admins as $admin) {
$admin_ids[] = $admin->ID;
$args = implode(',', $admin_ids);
$test_posts = get_posts("author=$args&orderby=rand&numberposts=-1");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.