Created
March 26, 2015 19:20
Revisions
-
LinzardMac created this gist
Mar 26, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ /** * override output of author drop down to include ALL user roles */ add_filter('wp_dropdown_users', 'include_all_users'); function include_all_users($output) { //set the $post global for checking user against author global $post; $users = get_users(); $current_user = wp_get_current_user(); $output = '<select id="post_author_override" name="post_author_override" class="">'; //Loop through each user foreach($users as $user){ //if the post's author matches the user ID, set it to "selected" so it will appear when you load the page //else, set as empty // In doing tests, it seems as though new posts set the "author" to the current user automatically if($post->post_author == $user->ID){ $select = 'selected'; }else{ $select = ''; } // end if post_author == user id //output an <option> tag with each user's info and output results of $select $output .= '<option value="'.$user->ID.'"'.$select.'>'.$user->user_login.'</option>'; } //end foreach $output .= '</select>'; return $output; }