Skip to content

Instantly share code, notes, and snippets.

@felixarntz
Created March 13, 2014 00:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save felixarntz/9519350 to your computer and use it in GitHub Desktop.
Save felixarntz/9519350 to your computer and use it in GitHub Desktop.
WordPress Nav Menu Transient Fix
<?php
function yourtheme_fix_nav_menu_css_class( $classes, $item )
{
return preg_replace( '/(current(-menu-|[-_]page[-_])(item|parent|ancestor))/', '', $classes );
}
if( YOURTHEME_USE_NAV_MENU_TRANSIENTS )
{
add_filter( 'nav_menu_css_class', 'yourtheme_fix_nav_menu_css_class', 10, 2 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment