# Is there a way to remove the lock badge for some categories but not for others?

**URL:** https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610
**Category:** UX
**Created:** [July 18, 2018, 9:03am UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610 "2018-07-18T09:03:23Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![franzmutschler](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/franzmutschler/32/141641_2.png) [@franzmutschler](https://meta.discourse.org/u/franzmutschler)
#### Post date: [July 18, 2018, 9:03am UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610/1 "2018-07-18T09:03:24Z")

</div>

Hello guys,

as the title suggests, I am looking for a way to remove the lock badge for some categories, but not for others.  
I managed to do this for the category-drop-header, since I can use the category ID to only remove the lock icon for this category, instead of globally.

I did not, however, manage to remove the icon for the badge in the category overview (cf. screenshot) and in the drop-down list of categories in the search.

Do you have any suggestions for me? I’m pretty new to working with CSS and I’ve exhausted my own approaches.

Thanks a lot!

 ![20](https://global.discourse-cdn.com/meta/original/3X/2/e/2e2e74e390d322e9c5799fbe78450175c74fe239.png)

edit:  
I read both of the following threads, but could not find a solution that worked for me:

> [@Alternatives to lock icon for categories](https://meta.discourse.org/t/alternatives-to-lock-icon-for-categories/24815/53):
>
> You can do all that with CSS too smile It may be ~4 lines but definitely do able. Plus since you can enable multiple styles now, you can simply have one for category alterations and keep it enabled wink My point was, no one is really customizing this icon today. So we’re bikeshedding here. “It would be great if we use X or Y or Z” without actually seeing people using it. I simply showed how easy it is to customize the icon. The background image is a bit harder, but by a smudge (I haven’t t…

> [@Howto: Change lock icon for restricted categories](https://meta.discourse.org/t/howto-change-lock-icon-for-restricted-categories/26217):
>
> Continuing the discussion from [Alternatives to lock icon for categories](https://meta.discourse.org/t/alternatives-to-lock-icon-for-categories/24815/63): @cpradio could you or someone else provide a simple howto for changing the lock icon for categories? It’s now coming up in my community as something they find confusing because it is the same as the topic lock icon. I had some trouble finding the actual howto instructions in this thread. Would be grateful!

---

<div class="post-metadata">

### Author: ![tshenry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tshenry/32/119495_2.png) [@tshenry](https://meta.discourse.org/u/tshenry)
#### Post date: [July 18, 2018, 10:49am UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610/2 "2018-07-18T10:49:43Z")

</div>

I think this should do it:

```scss
// Hide the lock icon for specific categories on topic lists and hamburger menu,
// and hide the lock icon on all dropdown search results
.search-menu .results .restricted,
[href="/c/MY-CATEGORY-SLUG1"],
[href="/c/MY-CATEGORY-SLUG2"],
[href="/c/MY-CATEGORY-SLUG3"] {
    .fa-lock {
        display: none;
    }
}

```

Just replace the `MY-CATEGORY-SLUG#` part with the slugs of the categories you want to have the lock icon hidden.

Unfortunately there isn’t enough to work with in the HTML to pick and choose which categories show the lock icon in the dropdown search results with CSS, so it’s all or nothing for that part. You will need to decide if you want to show or hide the lock for all restricted categories. If you want to show it, just remove this part: `.search-menu .results .restricted,`

Hopefully that gets you pretty close to what you are looking for!

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [March 26, 2023, 4:37pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610/3 "2023-03-26T16:37:34Z")

</div>

ok apologies for the necro, but i can’t seem to get this one to work. i’m trying to suppress the lock icon for our Lounge which has the slug “off-topic”. our Lounge wasn’t the default install, it was a created category and i have set permissions so that it isn’t viewable to non-members. but i don’t want the lock icon there because membership thinks it is a locked category.

i’m assuming i add this to the CSS code:

```plaintext
// Hide the lock icon for specific categories on topic lists and hamburger menu,
// and hide the lock icon on all dropdown search results
.search-menu .results .restricted,
[href="/c/off-topic"] {
    .fa-lock {
        display: none;
    }
}

```

the lock icon is still there. i don’t want to replace it globally and i like the idea of suppressing the lock icon in the category drop-down as well.

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [March 26, 2023, 5:15pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610/4 "2023-03-26T17:15:34Z")

</div>

Hi, what about this:

```css
.category-drop [data-value="ID"] .restricted,
[href^="/c/off-topic"] {
    .d-icon-lock {
        display: none;
    }
}

```

Replace `ID` with the off-topic category ID.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [March 26, 2023, 5:18pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610/5 "2023-03-26T17:18:31Z")

</div>

> [@Arkshine](#):
>
> ```plaintext
> .category-drop [data-value="ID"] .restricted,
> [href^="/c/lounge"] {
> .d-icon-lock {
> display: none;
> }
> }
> 
> ```

thank you for the reply. that suppressed it in the category search drop down, which is great. but i also want to suppress the lock icon globally for that category (not other locked elements), like on the category list page.

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [March 26, 2023, 5:20pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610/6 "2023-03-26T17:20:37Z")

</div>

I made a typo in the CSS; I wrote `lounge` instead of `off-topic`.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [March 26, 2023, 5:20pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610/7 "2023-03-26T17:20:57Z")

</div>

> [@franzmutschler](#):
>
> to remove the icon for the badge in the category overview (cf. screenshot)

this is exactly what i want to do.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [March 26, 2023, 5:22pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610/8 "2023-03-26T17:22:02Z")

</div>

> [@Arkshine](#):
>
> I made a typo in the CSS; I wrote `lounge` instead of `off-topic`.

fantastic! that did it. thank you so much 👏

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [March 26, 2023, 5:23pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610/9 "2023-03-26T17:23:43Z")

</div>

Glad it worked! Let me know if I missed a location 🙂

---

<div class="post-metadata">

### Author: ![Nick-Permaculture](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick-permaculture/32/317842_2.png) [@Nick-Permaculture](https://meta.discourse.org/u/Nick-Permaculture)
#### Post date: [August 24, 2023, 6:42pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610/10 "2023-08-24T18:42:33Z")

</div>

@Arkshine  
Using the code examples above, I was able to remove the lock for 2 categories on the main homepage and on the sidebar. Awesome!

However, the lock still appears on the category drop down menus. Both of these cateogies show no locks anywhere else, just in this menu.

![Screenshot 2023-08-24 at 2.41.52 PM](https://global.discourse-cdn.com/meta/original/4X/8/3/d/83d70197484e4929834be9b90b1597cf267ee381.png)

Any ideas?

EDIT:

I was able to remove the lock icon from the drop-down menus for ALL categories, but I can’t figure out how to remove it for only selected categories. Here’s the CSS:

```plaintext
.badge-wrapper.bullet span.badge-category, {
    .d-icon-lock {
        display: none;
    }
}

```

I tried using a similar CSS as above using the [data-value=“ID”] but that didn’t work in this instance.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [August 27, 2023, 4:20pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610/12 "2023-08-27T16:20:32Z")

</div>

I notice using CSS on lock icons is a bit tricky in places, so I made a theme component to easily accomplish this and it hides the lock icon for selected secure categories in the breadcrumb dropdown selector, the header bar breadcrumb, navigation sidebar menu, and corresponding chat channels. 🙂

> [@Hide Lock Badge Icon](https://meta.discourse.org/t/hide-lock-badge-icon/276831):
>
> information_sourceSummary Hides the lock badge icon for secure categories and chat channelshammer_and_wrenchRepository [https://github.com/Lillinator/hide-lock-badge-icon](https://github.com/Lillinator/hide-lock-badge-icon)questionInstall Guide [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) Install this theme component Overview This simple theme component allows for hiding lock badge icons for secure categories in the drop-down category selectors, header breadcrumbs, navigation sidebar menu, search results, and correspon…

---

<div class="post-metadata">

### Author: ![Nick-Permaculture](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nick-permaculture/32/317842_2.png) [@Nick-Permaculture](https://meta.discourse.org/u/Nick-Permaculture)
#### Post date: [August 29, 2023, 4:50pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610/13 "2023-08-29T16:50:57Z")

</div>

Thanks @Lilly . I saw your original response the other day and just now had time to do some edits, and came to find that you not only made it easier for me to do, but created an excellent theme component that will surely help countless people trying to accomplish the same thing. Thanks so much for your time and effort on this. Much appreciated.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [August 29, 2023, 4:54pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-the-lock-badge-for-some-categories-but-not-for-others/92610/14 "2023-08-29T16:54:21Z")

</div>

> [@Nick-Permaculture](#):
>
> Thanks @Lilly . I saw your original response the other day and just now had time to do some edits, and came to find that you not only made it easier for me to do, but created an excellent theme component that will surely help countless people trying to accomplish the same thing. Thanks so much for your time and effort on this. Much appreciated.

You’re very welcome and thank you for the lovely compliment. I quite enjoying developing theme component tools to help people extend the capabilities of their Discourse forums. 😊
