• 0

Wordpress user permissions


Question

Hi guys. I have a question about the admin section of Wordpress. Is it possible to limit the menu sections that a user has access to? For example, I want to define a user that sees only the Pages, Articles and Media menu links (or whatever I choose for hime), everything else should be hidden. I've read somewhere that this can be done by adding a piece of code to some file, but I am looking for some plugin that does this (if there is such a thing).

 

Thanks :)

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi guys. I have a question about the admin section of Wordpress. Is it possible to limit the menu sections that a user has access to? For example, I want to define a user that sees only the Pages, Articles and Media menu links (or whatever I choose for hime), everything else should be hidden. I've read somewhere that this can be done by adding a piece of code to some file, 

That would be the functions.php file in your theme folder.

 

 

but I am looking for some plugin that does this (if there is such a thing).

 

Thanks  :)

Why not write your own?

The code is simple enough:

<?php
/*
Plugin Name: Remove dashboard menus
Description: Who needs a description?
Version: 1.0
Author: TDT
Author URI: http://neowin.net
*/

    add_action( 'admin_menu', 'my_remove_menu_pages' );

    function my_remove_menu_pages() {
        remove_menu_page('link-manager.php'); //this is the remove menu item function, just change to whichever you want to remove.
        remove_menu_page('tools.php');           
    }
?>

Then you could wrap the above in an if statement to check user roles. Such as making it specific to subscribers:

$current_user = wp_get_current_user();
if (user_can($current_user, 'subscriber')) {
// enter above actions here to affect subscribers only
}
Link to comment
Share on other sites

  • 0

Thank you for your answer. It doesn't work, unfortunately. I can't activate the "plugin", I get an error right at the "function...." line. :(

Works perfectly for me.

Do you want to post your code so we can have a look?

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.