Skip to content

Instantly share code, notes, and snippets.

@webmandesign
Last active November 2, 2022 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webmandesign/0f56c1a9a219ab3ce251a5844d33924b to your computer and use it in GitHub Desktop.
Save webmandesign/0f56c1a9a219ab3ce251a5844d33924b to your computer and use it in GitHub Desktop.
WordPress 6.1.0 sub-menu issue fix
<?php
/**
* Put this code (without the "<?php" above) into your child theme's "functions.php" file.
* Use this only to fix sub-menu issue in WordPress 6.1.0.
* Tip: Check https://support.webmandesign.eu/child-theme/ for more info on child themes.
*/
add_filter( 'wp_nav_menu_args', function( $args ) {
$args['depth'] = 0;
return $args;
} );
@webmandesign
Copy link
Author

This code fixes WordPress 6.1.0 issue with sub-menus in navigation not displaying or working correctly.

Put the code (without opening <?php) into your child theme's functions.php file.

Tip: For more info on child themes check https://support.webmandesign.eu/child-theme/

@webmandesign
Copy link
Author

NOTE:
This code actually does not fix the WordPress 6.1.0 issue, it only prevents triggering it.
For more info about the issue check https://core.trac.wordpress.org/ticket/56946

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment