Max Mega Menu Shortcode

Below, you’ll find a detailed guide on how to add the Max Mega Menu Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Max Mega Menu Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Max Mega Menu Plugin and the shortcodes it provides:

Plugin Icon
Max Mega Menu

"Max Mega Menu is a user-friendly WordPress plugin that transforms your existing menu into a mega menu. It's fully customizable, providing a better navigation experience."

★★★★☆ (659) Active Installs: 400000+ Tested with: 6.3.2 PHP Version: 5.6
Included Shortcodes:
  • [maxmenu]

Max Mega Menu [maxmenu] Shortcode

The MaxMenu shortcode is a feature in WordPress that allows you to add a navigation menu to your website. The shortcode checks if a menu exists at the specified location. If it does, it displays the menu. If not, it returns a “menu not found” comment.

Shortcode: [maxmenu]


Here is a list of all possible maxmenu shortcode parameters and attributes:

  • location – indicates the specific area where the menu is placed

Examples and Usage

Basic example – Displays the navigation menu of the specified location. If the location does not exist or does not have a menu, it returns a comment saying “menu not found”.

[maxmenu location="header-menu" /]

Advanced examples

Displaying a specific theme’s navigation menu. If the specified theme does not have a navigation menu, it returns a comment saying “menu not found”. This is useful when you have multiple themes and you want to display a specific theme’s navigation menu.

[maxmenu location="theme-location" /]

Displaying a specific custom menu. If the specified custom menu does not exist, it returns a comment saying “menu not found”. This is useful when you have created custom menus and you want to display a specific custom menu.

[maxmenu location="custom-menu" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [maxmenu] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'maxmenu', array( $this, 'register_shortcode' ) );

Shortcode PHP function:

function register_shortcode( $atts ) {
			if ( ! isset( $atts['location'] ) ) {
				return false;

			if ( has_nav_menu( $atts['location'] ) ) {
				return wp_nav_menu(
						'theme_location' => $atts['location'],
						'echo'           => false,

			return '<!-- menu not found [maxmegamenu] -->';


Code file location:



Now that you’ve learned how to embed the Max Mega Menu Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.


Leave a Reply

Your email address will not be published. Required fields are marked *