# Hide Custom Header Links from anon

**URL:** https://meta.discourse.org/t/hide-custom-header-links-from-anon/277626
**Category:** Development
**Tags:** custom-header-links
**Created:** [March 23, 2020, 12:03am UTC](https://meta.discourse.org/t/hide-custom-header-links-from-anon/277626 "2020-03-23T00:03:42Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Rhidian](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rhidian/32/176630_2.png) [@Rhidian](https://meta.discourse.org/u/Rhidian)
#### Post date: [March 23, 2020, 12:03am UTC](https://meta.discourse.org/t/hide-custom-header-links-from-anon/277626/1 "2020-03-23T00:03:42Z")

</div>

Great theme component. Thank you.

Is there a way to hide the links if the user has to login to view the site content?  
This is what my site looks like on the login page with the theme enabled.

 ![image](https://global.discourse-cdn.com/meta/original/3X/b/b/bbc8510ec7abdf6ce4d14c6787be023306f09e86.png)

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [March 23, 2020, 12:09am UTC](https://meta.discourse.org/t/hide-custom-header-links-from-anon/277626/2 "2020-03-23T00:09:57Z")

</div>

Until there is a cleaner way to do it via an upgrade of the component, you can add this css lines in your theme

```css
.anon .custom-header-links {
    display: none;
}

```

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [March 29, 2020, 8:16pm UTC](https://meta.discourse.org/t/hide-custom-header-links-from-anon/277626/3 "2020-03-29T20:16:09Z")

</div>

> [@Steven](#):
>
> .anon .custom-header-links { display: none; }

This works a treat!!!

If any of you amazing coders out there could add the ability per link to make visible to

1. logged in users _or_
2. anon (eg not logged in) users _or_
3. all users

we would be extremely grateful!!!

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [March 29, 2020, 8:33pm UTC](https://meta.discourse.org/t/hide-custom-header-links-from-anon/277626/4 "2020-03-29T20:33:52Z")

</div>

Everything is still doable via css, but you have to create a line for each link which can take some time.

If we take the demo for this component :

[https://theme-creator.discourse.org/theme/Johani/custom-header-links](https://theme-creator.discourse.org/theme/Johani/custom-header-links)

I’ll try your 3 scenarios with the Tech example.

**Ex #1** visible to logged in users

```css
.anon .headerLink.tech {
    display: none;
}

```

**Ex #2** visible to not logged in users

```css
.headerLink.tech {
    display: none;
}
.anon .headerLink.tech {
    display: inline-block;
}

```

**Ex #3** visible to all users : don’t add anything

* * *

Replace text with the key word of your menu.

I’ll take a last example to help you. The css class to use for the item menu _Your Vote Counts!_ is `.headerLink.your-vote-counts`

---

<div class="post-metadata">

### Author: ![sallypf](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@sallypf](https://meta.discourse.org/u/sallypf)
#### Post date: [June 3, 2025, 3:46pm UTC](https://meta.discourse.org/t/hide-custom-header-links-from-anon/277626/5 "2025-06-03T15:46:22Z")

</div>

Thanks, helped me 🙂
