Support » Plugin: Intercom for WordPress » Question about roles

  • Resolved seifen


    Hi Simon,

    Hope this question is not too unrelated to the plugin:

    The following code

    $role = get_role( 'editor' );
    $role->add_cap( 'hide_from_intercom' );

    Is that only applicable to your plugin or does it work if I pasted the snippet from Intercom myself?

    I’m looking for just the very short snippet to exclude Admins and Editors from being sent to Intercom!


Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Simon Blackbourn


    That would only work with my plugin, because the code that checks for the hide_from_intercom capability is WordPress-specific, it’s not part of Intercom’s snippet code.

    If you’re pasting the snippet yourself (without the plugin), then you could do something like this:

    if ( ! current_user_can( 'edit_others_posts' ) ) {
        // code to display the snippet goes here

    That checks that the user does not have the edit_others_posts capability (which is usually only assigned to editors and above) in order to display the snippet.

    Hope that helps!

    Wow, you’re a hero! Thank you so much 🙂


    Plugin Author Simon Blackbourn


    Happy to help 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Question about roles’ is closed to new replies.