Remove current_page_parent from Search and 404
-
I want to stop my Blog menu item being highlighted when Search Results or a 404 is displayed. I’ve googled and searched here too but the only solution I have found doesn’t work for me:
function noCurrentNavInSearch( $content ) { if ( is_search() ) $content = preg_replace( '/ current_page[_a-z]*([\" ])/', '\1', $content ); if ( is_404() ) $content = preg_replace( '/ current_page[_a-z]*([\" ])/', '\1', $content ); return $content; } add_filter( 'wp_list_pages', 'noCurrentNavInSearch' );
Can any one give me a function that will work with the latest versions of WP?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Remove current_page_parent from Search and 404’ is closed to new replies.