Read only capability for custom post in admin area

brasolfilo’s suggestion that you remove the submit meta box is only part of what I’d consider a complete solution. I can hack a “submit” button into that page using FireBug or any of a few other tools, in a matter of minutes. I would… Remove the meta box. This is brasofilo’s solution, and I won’t … Read more

Confusion with adding meta capabilities to a role after registering a Custom Post Type with corresponding ‘capability_type’ parameter

Have you tried defining the capabilities inside the external_roles_post_type_init() function? After the ‘capability_type’ => array(‘external_role’, ‘external_roles’), try add this ‘capabilities’ => array( ‘publish_posts’ => ‘publish_external_roles’, ‘edit_posts’ => ‘edit_external_roles’, ‘edit_others_posts’ => ‘edit_others_external_roles’, ‘delete_posts’ => ‘delete_external_roles’, ‘delete_others_posts’ => ‘delete_others_external_roles’, ‘read_private_posts’ => ‘read_private_external_roles’, ‘edit_post’ => ‘edit_external_role’, ‘delete_post’ => ‘delete_external_role’, ‘read_post’ => ‘read_external_role’, ), as another argument of the … Read more

Temporarily give ‘manage_options’ capability

Good question! The capability checking is probably done quite early in the loading process. By looking at /wp-admin/users.php you can tell that one of the first things to happen is current_user_can( ‘list_users’ ), so that one is clearly needed or you’ll get the “Cheatin’ uh?” warning. But right before that, /wp-admin/admin.php is included, and at … Read more

Defining capabilities for custom post type

You code seems to be correct. Try the following instead. $args = array( ‘labels’ => $labels, ‘public’ => true, ‘publicly_queryable’ => true, ‘show_ui’ => true, ‘query_var’ => true, ‘rewrite’ => true, ‘hierarchical’ => false, ‘menu_position’ => null, ‘supports’ => array(‘title’), ‘capability_type’ => ‘video’ ); Update: You have to do some extra steps before making it … Read more

Allow user to Edit Posts but not Add New?

You will have to do something like this: function hide_buttons() { global $current_screen; if($current_screen->id == ‘edit-post’ && !current_user_can(‘publish_posts’)) { echo ‘<style>.add-new-h2{display: none;}</style>’; } } add_action(‘admin_head’,’hide_buttons’); See: http://erisds.co.uk/wordpress/spotlight-wordpress-admin-menu-remove-add-new-pages-or-posts-link for reference

Restrict Admin Capabilities in MultiSite

Editing super admin capabilities is a little different from editing the capabilities of every other role, because there is a slight detour in the way WP checks the current user’s capabilities. This is what you find on capabilities.php on line 864: function has_cap( $cap ) { // (…) // Multisite super admin has all caps … Read more

How to 301 private posts rather than 404?

Sorry guys, I found my answer: add_action(‘wp’,’redirect_stuffs’, 0); function redirect_stuffs(){ global $wpdb; if ($wpdb->last_result[0]->post_status == “private” && !is_admin() ): wp_redirect( home_url(), 301 ); exit(); endif; } Posts/Pages are removed from the sitemaps, but the page still shows up on the site so that it can get 301’d.