The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Menu-item not getting active class

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #188575

    Hi, I’m having troubles with one of my menu items, if you take a look at my site: – you can see that the navigation items gets bold and underlined when active, but not “findings” for some reason. Can anyone help me out? I’ve tried to style it with current_parent, current_ancestor etc…


    Well I just took a quick look, basically the current-menu-item class isn’t getting applied to your findings menu item. I don’t have much experience with WordPress but it might be something with the way the menu is built, I’m sorry I can’t be of more help but maybe this is enough information for you.


    Hi Tom, thank you for answering!
    Yes, thats correct. But what I find weird is that I don’t see any differences between findings and the other post-types in the menu. They should be identical.

    If anyone could help me out I would appreciate it!


    @nichlas 50mm, great photos…

    I’m looking at the site now, and everything works now, so I’m assuming it’s been fixed?


    I see the issue.

    How do you have your menus set up?

    It looks like you’re using Custom Post Type for findings.

    See this Gist here:


    Thanks @Alen!

    I found this code in the last comment of the page that you linked to:

    // Add class to current-menu-items
    function custom_active_item_classes($classes = array(), $menu_item = false){
    global $post;
    $classes[] = ($menu_item->url == get_post_type_archive_link($post->post_type)) ? 'current-menu-item active' : '';
    return $classes;
    add_filter( 'nav_menu_css_class', 'custom_active_item_classes', 10, 2 );

    Works like a charm! Thank you so much :)

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Back End’ is closed to new topics and replies.