Skip to main content

Assigning Authors

Learn all the ways to assign multiple authors to your posts.

The Authors Meta Box​

The main interface for assigning authors is the Authors meta box in the post editor.

Location​

Block Editor (Gutenberg):

Post Editor > Right Sidebar > Authors Panel

Classic Editor:

Post Editor > Right Sidebar > Authors Meta Box
(Usually below the Publish box)

How It Looks​

The meta box displays:

  • Search Box - Find authors by name
  • User List - All assignable users with checkboxes
  • Selected Authors - Checked users appear at the top
  • User Info - Shows username and display name

Assigning Authors​

Basic Assignment​

  1. Open Post Editor

    Posts > Add New (or edit existing post)
  2. Find Authors Meta Box

    • Look in the right sidebar
    • May need to scroll down
    • Click to expand if collapsed
  3. Select Authors

    • Check boxes next to author names
    • Select as many as you need
    • No limit on number of authors
  4. Save Changes

    • Click Publish or Update
    • Authors are now assigned!

Search for Authors​

If you have many users:

  1. Use Search Box

    • Type author name in search box
    • List filters in real-time
    • Check the box for desired author
  2. Clear Search

    • Clear search box to see all users again

Remove Authors​

To remove an author:

  1. Find the Author

    • Look in the list
    • Selected authors appear at top
  2. Uncheck the Box

    • Click checkbox to uncheck
    • Author is removed immediately
  3. Save

    • Click Update to save changes
warning

Every post must have at least one author. You cannot uncheck all authors.

Author Order​

Authors are displayed in the order they appear in the meta box:

Default Order​

  • Alphabetical by display name
  • First checked author appears first
  • Subsequent authors in alphabetical order

Changing Display Order​

Currently, the plugin displays authors in a fixed order. To customize order:

Use the filter:

add_filter( 'tmauthors_post_authors', 'custom_author_order', 10, 2 );

function custom_author_order( $authors, $post_id ) {
// Sort authors by ID (or any other criteria)
usort( $authors, function( $a, $b ) {
return $a->ID - $b->ID;
} );

return $authors;
}

👉 More Filters

Quick Edit Authors​

For faster bulk updates:

How to Use Quick Edit​

  1. Go to Posts List

    Posts > All Posts
  2. Hover Over Post

    • Hover mouse over any post
    • Action links appear
  3. Click Quick Edit

    • Click Quick Edit link
    • Inline editor opens
  4. Assign Authors

    • Find Authors section
    • Check/uncheck authors
    • Click Update button

When to Use Quick Edit​

✅ Good for:

  • Updating authors on multiple posts
  • Quick author changes
  • Bulk workflow

⚠️ Not good for:

  • Complex author assignments
  • When you need to see post content
  • First-time author assignment

Bulk Edit Authors​

Update authors on multiple posts at once:

How to Bulk Edit​

  1. Select Posts

    Posts > All Posts
    • Check boxes next to posts
    • Select multiple posts
  2. Choose Bulk Actions

    • Select Edit from Bulk Actions dropdown
    • Click Apply button
  3. Edit Authors

    • Bulk edit panel opens
    • Find Authors section
    • Select new authors
  4. Update

    • Click Update button
    • All selected posts updated!

Bulk Edit Options​

In bulk edit, you can:

  • ✅ Add Authors - Add to existing authors
  • ✅ Replace Authors - Replace all with new authors
  • ✅ Remove Authors - Remove specific authors
note

Bulk edit behavior depends on how the checkboxes are used. Checked boxes mean "set these authors", unchecked means "don't change".

Managing Assignable Authors​

Who Can Be Assigned?​

By default, these user roles can be assigned as authors:

  • ✅ Administrator
  • ✅ Editor
  • ✅ Author
  • ✅ Contributor
  • ❌ Subscriber (not assignable by default)

Customize Assignable Roles​

Use the filter to customize:

add_filter( 'tmauthors_assignable_roles', 'custom_assignable_roles' );

function custom_assignable_roles( $roles ) {
// Add subscriber role
$roles[] = 'subscriber';

// Or limit to specific roles
// return array( 'administrator', 'editor', 'author' );

return $roles;
}

Customize Assignable Users​

For fine-grained control:

add_filter( 'tmauthors_assignable_users', 'filter_assignable_users', 10, 2 );

function filter_assignable_users( $users, $post_id ) {
// Only allow users with specific capability
$filtered_users = array_filter( $users, function( $user ) {
return user_can( $user->ID, 'publish_posts' );
} );

return $filtered_users;
}

Author Capabilities & Permissions​

Who Can Assign Authors?​

By default, these capabilities can assign authors:

  • Administrators - Can assign anyone
  • Editors - Can assign anyone
  • Authors - Can only assign themselves
  • Contributors - Cannot assign authors

Customizing Permissions​

Allow authors to assign other authors:

add_filter( 'tmauthors_user_can_assign_authors', 'custom_author_permissions', 10, 3 );

function custom_author_permissions( $can_assign, $user_id, $post_id ) {
$user = get_user_by( 'id', $user_id );

// Allow authors to assign other authors
if ( in_array( 'author', $user->roles ) ) {
return true;
}

return $can_assign;
}

Prevent Self-Assignment​

Don't allow users to add themselves:

add_filter( 'tmauthors_validate_author_assignment', 'prevent_self_assignment', 10, 3 );

function prevent_self_assignment( $valid, $post_id, $author_ids ) {
$current_user_id = get_current_user_id();

// Remove current user from author list
$author_ids = array_diff( $author_ids, array( $current_user_id ) );

// If no authors left, invalid
if ( empty( $author_ids ) ) {
return new WP_Error(
'no_authors',
'You cannot be the only author of your own post.'
);
}

return $valid;
}

Author Assignment Validation​

The plugin validates author assignments:

Validation Rules​

  1. At Least One Author

    • Every post must have at least one author
    • Cannot save with zero authors
  2. Valid User IDs

    • All author IDs must correspond to valid WordPress users
    • Invalid IDs are ignored
  3. Assignable Users

    • Only assignable users can be set as authors
    • Non-assignable users are rejected
  4. Capability Check

    • Current user must have permission to assign authors
    • Checked on save

Custom Validation​

Add your own validation:

add_filter( 'tmauthors_validate_author_assignment', 'custom_author_validation', 10, 3 );

function custom_author_validation( $valid, $post_id, $author_ids ) {
// Example: Limit to 3 authors maximum
if ( count( $author_ids ) > 3 ) {
return new WP_Error(
'too_many_authors',
'Posts cannot have more than 3 authors.'
);
}

// Example: Require at least 2 authors for specific category
$post = get_post( $post_id );
if ( has_category( 'collaborative', $post ) && count( $author_ids ) < 2 ) {
return new WP_Error(
'insufficient_authors',
'Collaborative posts must have at least 2 authors.'
);
}

return $valid;
}

Programmatic Assignment​

Assign authors via code:

Set Authors​

// Set authors for a post
$post_id = 123;
$author_ids = array( 1, 5, 12 ); // User IDs

$result = tmauthors_set_post_authors( $post_id, $author_ids );

if ( is_wp_error( $result ) ) {
echo 'Error: ' . $result->get_error_message();
} else {
echo 'Authors assigned successfully!';
}

Add an Author​

// Add a single author to existing authors
$post_id = 123;
$new_author_id = 8;

tmauthors_add_post_author( $post_id, $new_author_id );

Remove an Author​

// Remove a single author
$post_id = 123;
$author_to_remove = 5;

tmauthors_remove_post_author( $post_id, $author_to_remove );

On Post Creation​

// When creating a new post
$post_id = wp_insert_post( array(
'post_title' => 'My New Post',
'post_content' => 'Content here...',
'post_status' => 'publish',
'post_author' => 1, // Primary author
) );

// Assign multiple authors
if ( $post_id && ! is_wp_error( $post_id ) ) {
tmauthors_set_post_authors( $post_id, array( 1, 5, 8 ) );
}

Guest Authors​

To add guest authors who don't have WordPress accounts:

Create Guest User​

  1. Add New User

    Users > Add New
  2. User Details

    • Username: guest-john-doe
    • Email: [email protected]
    • First Name: John
    • Last Name: Doe
    • Website: https://johndoe.com
    • Bio: John is a guest contributor...
  3. Set Role

    • Role: Contributor (or custom role)
  4. Create User

    • Click Add New User
  5. Assign to Posts

    • Edit your post
    • Select the guest user as author

Guest Author Best Practices​

  • Use consistent username format: guest-firstname-lastname
  • Use identifiable email: [email protected]
  • Fill out user profile completely
  • Consider creating custom "Guest Author" role
  • Document guest authors for future reference

Import/Migration​

From Other Plugins​

If migrating from another multi-author plugin:

Co-Authors Plus Migration:

// Migration script (run once)
function migrate_from_coauthors() {
$posts = get_posts( array(
'post_type' => 'post',
'posts_per_page' => -1,
) );

foreach ( $posts as $post ) {
// Get Co-Authors Plus authors
if ( function_exists( 'get_coauthors' ) ) {
$coauthors = get_coauthors( $post->ID );

$author_ids = array();
foreach ( $coauthors as $author ) {
$author_ids[] = $author->ID;
}

// Set in ThemeRuby Multi Authors
tmauthors_set_post_authors( $post->ID, $author_ids );
}
}
}

Bulk Import via CSV​

If you have author data in CSV:

// Import authors from CSV
function import_authors_from_csv( $csv_file ) {
$csv_data = array_map( 'str_getcsv', file( $csv_file ) );

foreach ( $csv_data as $row ) {
$post_id = $row[0];
$author_ids = explode( ',', $row[1] );

tmauthors_set_post_authors( $post_id, $author_ids );
}
}

Troubleshooting​

Authors Not Saving​

Possible causes:

  • Insufficient permissions
  • Post type not supported
  • JavaScript error

Solution:

  1. Check browser console for errors
  2. Verify user has edit_posts capability
  3. Ensure post type is enabled in settings

Authors Meta Box Not Showing​

Possible causes:

  • Post type not supported
  • Screen options disabled
  • JavaScript not loaded

Solution:

  1. Go to Settings > ThemeRuby Multi Authors
  2. Enable the post type
  3. Check Screen Options (top right)
  4. Enable Authors meta box

Cannot Assign Certain Users​

Possible causes:

  • User role not assignable
  • Custom filter excluding user

Solution:

  • Check user role (Subscriber not assignable by default)
  • Review custom filters in your theme/plugins

Next Steps​