How can I remove “Add new” button on custom post type
How can I remove “Add new” button on custom post type
How can I remove “Add new” button on custom post type
Groups roles & capabilities
Adding custom capabilities should use the ‘admin_init’ hook. Your function can look like this: function add_bounty_product_caps() { $role = get_role( ‘mmv_multi_vendor’ ); $role->add_cap( ‘edit_crea_resi’ ); $role->add_cap( ‘edit_crea_resis’ ); $role->add_cap( ‘edit_others_crea_resis’ ); $role->add_cap( ‘publish_crea_resis’ ); $role->add_cap( ‘read_crea_resi’ ); $role->add_cap( ‘read_private_crea_resis’ ); $role->add_cap( ‘delete_crea_resi’ ); $role->add_cap( ‘edit_published_crea_resis’ ); $role->add_cap( ‘delete_published_crea_resis’ ); $role->add_cap( ‘edit_crea_spedizioni’ ); $role->add_cap( ‘edit_crea_spedizionis’ ); … Read more
If it’s supposed to edit its own post only, make it with author‘s capabilities. If it should edit posts of other users, as well, make it with editor‘s capabilities. Case 1 function wpse_add_your_role() { $role = get_role( ‘author’ ); if ( ! empty( get_role( ‘your_role’ ) ) ) { remove_role( ‘your_role’ ); } add_role( ‘your_role’, … Read more
Yes it’s very easy. You’ll want to use the add_role() function to add your custom roles – https://codex.wordpress.org/Function_Reference/add_role Then you can use add_cap to add custom capabilities – https://codex.wordpress.org/Function_Reference/add_cap One important thing to mention is that both add_role and add_cap are saved to the database so they only need to run 1x so it’s good … Read more
Ok so few things.. there’s a pretty well coded plugin that handles user roles and permissions: https://wordpress.org/plugins/user-role-editor/ If you’d like to do this programatically though, you should: <?php function wpcodex_set_capabilities(){ global $wp_roles; // global class wp-includes/capabilities.php $role=”editor”; $cap = ‘publish_pages’; $wp_roles->remove_cap( $role, $cap ); } add_action( ‘init’, ‘wpcodex_set_capabilities’ ); ?> Lmk if that does it … Read more
It’s a little hackish and should be completed but it works for now. Also I had a chat with the people from WooThemes and they told me this feature should be available in the following months within the plugin, so this will become obsolete. //Hack – Shows only user’s own resources if the user does … Read more
How to add capabilities for editor type user to access admin section
I recommend to try by debugging the code, might be there is an issue because of a New version of PHP. Try by writing this code into the wp-config.php file and see what if any error: // Enable WP_DEBUG mode define( ‘WP_DEBUG’, true ); // Enable Debug logging to the /wp-content/debug.log file define( ‘WP_DEBUG_LOG’, true … Read more
By using this functionality we can able to remove the delete option of the page or post. function wp_restrict_page_deletion( $caps, $cap, $user_id, $args ) { $post_id = $args[0]; if ( $cap === ‘delete_post’ && $post_id === your post id* ) { $caps[] = ‘do_not_allow’; } return $caps; } add_filter( ‘map_meta_cap’, ‘wp_restrict_page_deletion’, 10, 4 ); I … Read more