How to Hide Jetpack from Contributors?

Community Forums Forums General Discussion How to Hide Jetpack from Contributors?

This topic is: not resolved

This topic contains 3 replies, has 2 voices, and was last updated by  Fabio 7 months, 3 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #81972

    Fabio
    Participant
    Post count: 178

    Hi there,
    does anybody know how to hide Jetpack from contributors without using a plugin?

    Thanks!
    Fabio

    #81996

    Craig
    Member
    Post count: 6

    Hi Fabio, you can remove the Jetpack menu item from all users except Admin with the following code. If you wanted to show Jetpack to users of Editor level and upwards you could modify current_user_can to include a capability of ‘publish_posts’ for example. (Roles & Capabilities ).

    add_action( 'jetpack_admin_menu', 'hide_jetpack_from_others' );
    function hide_jetpack_from_others() {
        if ( ! current_user_can( 'administrator' ) ) {
            remove_menu_page( 'jetpack' );
        }
    }
    #82214

    Fabio
    Participant
    Post count: 178

    Oh wow,
    that was easy :)
    thanks man.

    Should I get worried this piece of code may need changes with wordpress/genesis upgrades?

    Thanks again.
    Fabio

    #82215

    Fabio
    Participant
    Post count: 178

    Just a quick thought that came into my mind right now,
    But if I hide jetpack from the menu can contributors still sneakily link it to their wordpress.com account from the other end??

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.