[wp-hackers] Custom Post Type with contributor-like capabilities?

Jake Goldman wphackers at jakemgold.myfastmail.com
Fri Jun 25 20:16:55 UTC 2010

  I'm attempting to create a custom post type "guest blogs" with a 
contributor-like custom role, "guest blogger".

When registering the custom post type, I pass a custom capability for 
"edit_posts" using the "capabilities" argument ("guest_blog"). The 
"guest blog" capability is added to the new custom "guest blogger" role, 
as well as a few other roles (like administrator).

The Guest Posts menu does show up for users with the custom role, as 
expected, along with the "Add New" sub menu item.

Clicking Add New successfully takes the "guest blogger" to the add new 
post page. As soon as the editor is focused, a warning that the user is 
not allowed to edit the post appears. Attempting to save a draft or 
submit for review results in a "not allowed to edit this post" error. To 
troubleshoot, I bumped the user up to Admin, and he was able to save a 
draft guest post. I then dialed the user back down to "guest blogger", 
and the user is not able to edit the post in the post list either.

I've tinkered with the other post type capabilities, including the 
"edit_post" (singular) which  - in theory - shouldn't need to be messed 
around with. Explicitly adding an "edit_post" capability to the role 
does actually let the user submit posts for review and edit his or her 
own posts - in addition to *all* user posts.

Seems like a bug in the custom post type functionality. Am I missing 
something? Before I start copying and pasting code, does anyone else 
have experience with this problem?

Didn't see anything obvious in Trac, but it can be tricky to search.


More information about the wp-hackers mailing list