I have custom post types that I would like to make editable by several users. I created one custom post type using the Toolset plugin. wp_update_post only allows us to set single author:

$user_id = array();
$userIds = get_field("agency_to_author",$_POST['post_ID']); // Get Multiple User assing using acf field.
foreach ($userIds as $key => $value) {
     $user_id[] = $value['ID'];
     $arg = array(
         'ID' => $_POST['post_ID'],
         'post_author' => $user_id,
     wp_update_post( $arg );    

Easy way: use this plugin https://wordpress.org/plugins/user-role-editor/

More complicated way: You can use functions.php to add all of the custom capabilities to a specific roles. But ofc you need a name of these capabilities.

This code is usefull if you want to add X same capabilities to X roles.

Add to functions.php

   function wphm_add_custom_capabilities_to_roles($roles, $capabilities) {
     foreach($roles as $the_role) {
       $role = get_role($the_role);
       foreach($capabilities as $capability) {
         $role -> add_cap($capability);

    array(  // these roles will recieve capabilities
    array( // capabilities

To remove a capability with this loop just modify a line $role -> add_cap($capability); to $role -> remove_cap($capability)

  • I want to assign multiple author on single custom post type is it possible with wp_update_post function or any other way? Oct 12 '16 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.