csstagshideloginstatus

Hide tags in wordpress posts (blogs) via CSS for logged-out users


I would like, as the title suggests, hide the tags under a wordpress post (aka blog) for logged-out users. Usually this is not a problem by using CSS, just open the developer console (F12) and look up the class that you need to change. The class name is "entry-tags" (I assume), or maybe it isn't - because when I used my usual CSS code for this, nothing happened:

body:not(.logged-in) .entry-tags{
    display: none !important;
}

Does somebody know a way around this? Maybe use something else beside CSS. IF you got a solution, please describe it in a little more detail (what to do, where to do it), because I'm by no means a coding savant). If I hide it for logged-in users with this code, it works:

body.logged-in .entry-tags {
display: none !important;
}

Please help! Dumb, unnecessary comments also are a waste of everyone's time.


Solution

  • How about this?:

    body .entry-tags {display: none;}
    body.logged-in .entry-tags {display: block;}
    

    Whether the .entry-tags selector is correct or not, is for yourself to figure out and decide using the developer console/inspector.