I've built a marketplace-type site that gives users the option to post, edit, and delete listings via
For those listings, I've set up custom post types.
The problem is that only administrators are able to delete posts. The link displays correctly, but when clicked the user either is returned to the site's home page or to the current page, but nothing happens to the post.
I'm really confused about this and have spent several hours googling and trying various solutions, but none of them worked.
Among the things I tried are:
map_meta_capto both true and false and setting up either custom
capability_typeor leaving it at
- setting up a custom user role with specific
- installing the Members Plugin and assigning literally all available 181 permissions to the Subscriber role without any effect (i.e. when I
var_dump()the capabilities it looks exactly like an admin, but behaves differently)
- logging out various checks (
$post->post_author == $current_user->ID, etc.)
- passing various combinations of arguments to
I'm at the end of my wits with this.
I'd also appreciate any advice on alternative methods of "deleting" my posts. I've also though about coding up a custom AJAX function, but was scared that it would fail because of the same strange permission problem (if it is a permission problem).
Thanks for your help!