Created
December 3, 2014 17:56
-
-
Save alessandrotesoro/5ed2dc1e4ec425c98c18 to your computer and use it in GitHub Desktop.
Display all users into the "Author" box
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('wp_dropdown_users', 'tdp_custom_wp_dropdown_users'); | |
function tdp_custom_wp_dropdown_users($output) { | |
global $post; | |
$users = get_users(); | |
$output = "<select id=\"post_author_override\" name=\"post_author_override\" class=\"\">"; | |
$output .= "<option value=\"1\">Admin</option>"; | |
foreach($users as $user) { | |
$sel = ($post->post_author == $user->ID)?"selected='selected'":''; | |
$output .= '<option value="'.$user->ID.'"'.$sel.'>'.$user->user_login.'</option>'; | |
} | |
$output .= "</select>"; | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment