Why can’t my admin account manage attachments on a custom post type with a unique capability type?

I’ve created a custom post type called ‘directory’ and assigned it the capability type of ‘listing’. It has a unique capability type because I want to restrict Contributors to only be able to create/edit/publish this post type, which I am restricting via capabilities. There are the capabilities that were created by the MapCap plugin:

  • Delete listings
  • Delete published listing posts
  • Edit listings
  • Edit private listing posts
  • Edit published listing posts
  • Publish listings
  • Read private listings

For the Contributor, everything is working properly, and he/she can create, and only edit his/her own posts, and can upload attachments.

Read More

The Admin account has all the same capabilities, but isn’t fully working. I can create a post, and edit any of the others. But it does not give me full rights to the attachments. In the media library, any files I upload with this custom post type can’t be deleted when I am logged in as the admin. (I am still able to Trash the attachments by other authors, just not my own uploaded as admin.)

The closest thing I’ve found is this message on WordPress Trac that describes how attachments can’t be edited without the edit_post/delete_post capability.

I assume this is simply a matter of me not having proper capabilities assigned to the post type, but I’ve not had any luck finding the right combination.

Related posts

Leave a Reply

2 comments

  1. My educated guess is the issue comes from attachment being separate post type. It might seem like utility by purpose, but by nature it is specialized post type.

    Unfortunately your specific setup is not trivial to reproduce to confirm.