Remove Posts Quick Edit link for specific user role? WP 3.3

Based on this answer, yours was easy: add_filter(‘post_row_actions’, ‘wpse_49800_qe_download_link’, 10, 2); add_filter(‘page_row_actions’, ‘wpse_49800_qe_download_link’, 10, 2); // for Custom Post Types // add_filter(‘cpt_name_row_actions’, ‘wpse_49800_qe_download_link’, 10, 2); function wpse_49800_qe_download_link($actions, $post) { unset($actions[‘inline hide-if-no-js’],$actions[‘trash’]); return $actions; } Notice that you don’t mention the ‘Trash’, so it’s being removed as well. Plugin of interest Adminimize is able to hide … Read more

How to add more than 1 user role to sub-menu pages

The easiest way is create 2 custom capabilities and assign both to administrators, one to role coach and one to role player. When you create your roles you do something like this: $coach_caps = array( ‘read’ => true, ‘something_else’ => true, ‘can_open_coach_menu’ => TRUE // this is important for your scope ); add_role( ‘coach’, ‘Coach’, … Read more

How to restrict specific post types from being read or added by specific user roles (eg. author)?

For the solution to your question, In the register_post_type arguments, use the capability_type parameter & then grant the specific capabilities to the users. For instance, if you set ‘capability_type’ => ‘supplier’, grant the edit_supplier capability to all administrators only More Details capabilities takes an array of the capabilities in the format ‘edit_post’ => ‘edit_supplier’ This … Read more

Specific post user permissions

You can conditionally control which user role has the capability to edit posts edit_posts By default, contributors can edit their posts however you can add or remove capabilities for different roles and user i.d’s. add_action( ‘init’, ‘new_role_edit_posts’ ); function new_role_edit_posts() { if ( is_single(‘007’) { $role = get_role( ‘new-role’ ); $role->add_cap( ‘edit_posts’ ); } } … Read more

Prevent Contributor to show comment list

Paste this code inside the functions.php file of your currently active theme. You can make it a plugin file too. It uses the “the_comments” filter to remove the unwanted comments from the backend table. /** * Filter out comments of other posts than current logged-in user. * * @param $all_comments all the comments to be … Read more

Make certain pages uneditable by editors?

You can try the map_meta_cap filter: /** * Uneditable posts/pages for editors */ add_filter( ‘map_meta_cap’, function ( $caps, $cap, $user_id, $args ) { // Edit to your needs: $post_ids = [123, 234, 345, 456]; // Uneditable posts $role=”editor”; // Uneditable by this user role // Make given posts uneditable for the above user role: if … Read more

Add a drop down list to comment form?

Filter comment_form_field_comment to add a select element with a label. Add a callback to the action comment_post to save the value. Filter comment_text to show the value for a comment. Sample code: add_filter( ‘comment_form_field_comment’, function( $field ) { global $wp_roles; $user = wp_get_current_user(); $select=”<p><label for=”roleselect”>Your role:</label> <select name=”prefix_role” id=”roleselect”> <option value=””>Select a role</option>”; foreach ( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)