Restricting access to files within a specific folder [duplicate]

This question already has answers here: Closed 9 years ago. Possible Duplicate: How to Protect Uploads, if User is not Logged In? Is there any way at all to restrict direct access to files within a specific folder to only specific wordpress users that have that specific capability set? 1 Answer 1 The easiest php … Read more

grant a privilege for roles (for example editors) and higher

My wordpress theme has a custom post-type. Only editors (and higher) should be allowed to use this post type. I did this with: function add_capability($role,$cap) { $role_obj = get_role($role); // get the the role object $role_obj -> add_cap($cap); // add $cap capability to this role object } function set_cpt() { add_capability(‘editor’, ‘edit_cpt’); add_capability(‘editor’, ‘read_cpt’); add_capability(‘editor’, … Read more

How to set privilege to wordpress subscriber for private page

I am having private page.I want to show this page only when “subscriber” logged in.”Editor” should not access this page.How can i set the privilege. 2 Answers 2 Without a plugin something like this should work //functions.php function get_user_role() { global $current_user; $user_roles = $current_user->roles; $user_role = array_shift($user_roles); return $user_role; } //page template $role = … Read more

Forbid contributors viewing drafts

Is there any way I can forbid a contributor to view draft posts? Right now any contributor can view my draft posts and even edit them (however their edits must be approved by administrator first). 1 Answer 1 Yes, but you might need a plugin like ‘User Role Editor’. You can then edit the capabilities … Read more

How to enable a site administrator to edit users in a WordPress network/ multisite setup?

I have a few sites in a network. I don’t want the site administrators to manage things like network plugins, but I would like them to be able to edit profiles of all network users, not use those on their site. At the top of the /wp-admin/network/users.php file is this: if ( ! current_user_can( ‘manage_network_users’ … Read more