Active class to current link

Edit

Two things:

  1. wp_nav_menu() also outputs .current_page_item, as backward compatibility with wp_page_menu().
  2. Among the list item CSS classes added by wp_nav_menu(), for a custom post type, list items will have a CSS class .list-type-object-{slug}, where {slug} is the CPT slug. So, you could target: .list-type-object-{slug}.current-list-item

Original Answer

The key is in the class name: .current_page_item. That class is added by wp_page_menu(), whereas wp_nav_menu() adds .current-list-item.

What that means is that wp_nav_menu() is outputting its fallback menu, and not a user-created custom nav menu.

Ensure:

  1. Custom nav menu Theme Location is registered via register_nav_menu() or register_nav_menus()
  2. Call to wp_nav_menu() includes the theme_location parameter *and not the menu parameter, and that thetheme_locationpassed towp_nav_menu()matches the one defined inregister_nav_menu()/register_nav_menus()`
  3. At least one custom nav menu is defined via Appearance -> Menus
  4. A defined custom nav menu is assigned to the Theme Location that corresponds to theme_location passed to wp_nav_menu().

For example:

  1. Register

    function wpse117502_theme_setup() {
        register_nav_menus( array(
            'primary' => 'Primary'
        ) );
    }
    add_action( 'after_setup_theme', 'wpse117502_theme_setup' );
    
  2. Call

    wp_nav_menu( array(
        'theme_location' => 'primary'
    ) );
    
  3. Define

    User creates a menu, e.g. “Main Menu”

  4. Assign

    User assigns “Main Menu” to “Primary” Theme Location