By default the wp_nav_menu()
function generates HTML with both a container and UL menu. It will, by default, output some HTML structure that looks like this:
<div id="container_id" class="container_class">
<ul id="menu_id" class="menu_class">
<li>...</li>
</ul>
</div>
Since you have defined the container as a ul
, WordPress will try to keep the some valid HTML standards by only allowing the container to be one of 2 block level elements, See Line 152:
<div>
<nav>
You can filter it but I wouldn’t suggest it. So by passing a ul
to the container it ignores it and since it’s being ignored it doesn’t consider it a container and thus you cannot add a container class or container ID.
The ul
would be your menu
which is why you can add menu_class
and menu_id
.