Hi. I’m using the custom statuses for contributors feature but I’ve discovered that they can’t change a custom status from one that only editors can change to one that contributors can change.
In my setup, I have 7 custom statuses:
- Pitch – default
- Assigned – Post idea assigned to writer.
- In Progress – Writer is working on the post.
- Draft
- Pending Review – Editor needs to review the post and write the excerpt.
- Needs SEO – Admin needs to optimize the post for search engines and check the slug.
- Ready to Publish – Editor needs to publish or schedule the post for publishing.
Only an editor can change a post from “Pitch” to “Assigned”. Contributors can’t assign pitches to themselves or anyone else.
When a contributor starts working on the post they were assigned to, they are unable to change the status from “Assigned” to “In Progress” or “Pending Review” to let the editor know they are working on the story or are done with the story.
As a workaround, the contributors use the Editorial Comments feature to notify the editor and the admin that they need the post status changed.
I was hoping that contributors could change from an editor/admin assigned status to one that they can control.
Here’s the code I used:
function efx_limit_custom_statuses_by_role( $custom_statuses ) {
$current_user = wp_get_current_user();
switch( $current_user->roles[0] ) {
// Only allow a contributor to access specific statuses from the dropdown
case 'contributor':
$permitted_statuses = array(
'pitch',
'draft',
'in-progress',
'pending-review',
);
// Remove the custom status if it's not whitelisted
foreach( $custom_statuses as $key => $custom_status ) {
if ( !in_array( $custom_status->slug, $permitted_statuses ) )
unset( $custom_statuses[$key] );
}
break;
}
return $custom_statuses;
}
add_filter( 'ef_custom_status_list', 'efx_limit_custom_statuses_by_role' );