Skip to content

Instantly share code, notes, and snippets.

@marushu
Created April 4, 2014 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marushu/9976963 to your computer and use it in GitHub Desktop.
Save marushu/9976963 to your computer and use it in GitHub Desktop.
<?php
// 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