• Resolved theatereleven

    (@theatereleven)


    If any of you have a role on your site that represents people who need to be set to Author on existing content, you’ve probably noticed your role doesn’t show in the author drop-down area for a post or custom post type.

    The solution was posted somewhere else 3 years ago, but this worked for me – placing this in your functions.php tells WordPress to show all users in the drop down list:

    // Filter to fix the Post Author Dropdown
    add_filter('wp_dropdown_users', 'theme_post_author_override');
    function theme_post_author_override($output)
    {
      // return if this isn't the theme author override dropdown
      if (!preg_match('/post_author_override/', $output)) return $output;
    
      // return if we've already replaced the list (end recursion)
      if (preg_match ('/post_author_override_replaced/', $output)) return $output;
    
      // replacement call to wp_dropdown_users
    	$output = wp_dropdown_users(array(
    	  'echo' => 0,
    		'name' => 'post_author_override_replaced',
    		'selected' => empty($post->ID) ? $user_ID : $post->post_author,
    		'include_selected' => true
    	));
    
    	// put the original name back
    	$output = preg_replace('/post_author_override_replaced/', 'post_author_override', $output);
    
      return $output;
    }

    Hope it helps. Jason posted this, and it was a life saver for me!

    https://wordpress.org/plugins/members/

  • The topic ‘Role not showing in Author list for post’ is closed to new replies.