WordPress: Check user capabilities on a post
…
|
1 2 3 4 5 |
<code>$ptype = get_post_type_object($post_type); // eg. 'post', 'page' if ( !current_user_can( $ptype->cap->edit_posts ) ) { wp_die( __( 'You are not allowed to create posts or drafts on this site.' ) ); } </code> |


