Quick tip: Hide the Home Item on Your Front Page in WordPress

The title says it all — this one-liner CSS will hide the home item from your navigation menu, when you’re on the home page:

body.home .current-menu-item { display: none; }

If you’re not yet using wp_nav_menu to build your navigation menus, then, uhm, wake up! Also, the snippet relies on the body_class usage in your theme, and if your theme doesn’t use one, uhm, wake up! :)

I also want to avoid the discussion about how the primary navigation should be consistent through each and every page on the website, if at all possible :)

About the author

Konstantin Kovshenin

WordPress Core Contributor, ex-Automattician, public speaker and consultant, enjoying life in Moscow. I blog about tech, WordPress and DevOps.

2 comments