wp_nav_menu output is filtered or manipulated by theme


Some themes will manipulate the UberMenu output in a non-standard way, resulting in breaking the menu style, layout, and functionality, as the markup is not as expected.


Normally, the output of the wp_nav_menu function is immediately printed. Some themes will take this output and manipulate it via replacement functions or regular expressions. This is almost always bad practice. The proper way to manipulate the wp_nav_menu output is via the use of a custom navigation walker

The Problem

UberMenu has already created all of its markup; then the theme manipulates that HTML before it is displayed. As a result, the markup is not as expected, and UberMenu styles, layouts, and functionality are likely to break.

Identifying the issue

You’ll need to find the wp_nav_menu function call and check how it its output is handled. This function is called in the header.php under normal circumstances, but you may need to do a global search on your theme files to locate it.

Look for the echo parameter being set to false and the result being captured in a variable, then manipulated, i.e.

$menu = wp_nav_menu( 'echo' => false );
$menu = str_replace( 'menu' , 'evil-menu' );
echo $menu;

The Solution

Remove any manipulation of the menu output variable and just echo it as-is.