I am trying to: Allow Contributors to edit their own "Dogs" (custom content type) posts. Contributors submit new Dogs. The Dogs are approved by an Admin. Once approved, Contributors should be able to edit. However, they only see a "view" option and are not allowed to edit their own Dogs.
Link to a page where the issue can be seen:
I expected to see:
Instead, I got:
Hi, normally the Contributor role is locked out of their posts once they have been published. There is a capability you can add that gives them the ability to edit their own published posts, but those edits do not go through approval workflows. The edits are immediately published. If that's okay with you, I can share that capability and help you set it up. If not, custom code is required for this type of role modification, because you must also manage the post status whenever updating posts from the published status. Those posts must become unpublished, and must be returned to the review workflow.
Hi Christian,
Thanks for your reply. So this is a feature and not a bug! It'd be nice if we had a way to route edits to approved content back through the approval process. Has anyone ever requested that? Is it possible? Meanwhile, yes, please share the capability for editing published posts.
Thanks,
Matt
Here is some code you can add to your child theme's functions.php file to enable Contributors to edit published "dog" posts:
add_filter('init', function () {
$role = get_role('contributor');
$role->add_cap('edit_published_dogs');
});
However, I was running some tests and it seems that bringing Dogs under Access Control overrides this code. I'm asking my 2nd tier support team if this is expected, or if there is another workaround.
Unfortunately our Access developers say this is the expected behavior, as contributors should not be able to edit their own published posts. A custom code solution would be required to enable this capability, and we don't have a cut and paste snippet available to allow this when Access control is active for a post type. If you need assistance with that, feel free to reach out to an independent professional at our portal: https://toolset.com/contractors