Get the Menu ID for “My Account” (WooCommerce): Dynamic Menus, Shortcodes & Hooks

Have you ever wanted to customize your WooCommerce menu—especially that “My Account” menu—but felt completely lost? Don’t worry. You’re not alone. It might look a bit techy, but getting the Menu ID for “My Account” and customizing it is easier than it seems.
Let’s break it down step by step. We’ll sprinkle in some shortcodes, a few hooks, and tips on how to make your menu dynamic. Oh, and we’ll even show you how to find that mysterious Menu ID like a true WooCommerce wizard. 🪄
💡 What Is the “My Account” Menu?
The “My Account” menu is a special menu in WooCommerce. It helps users view their orders, change account details, and manage downloads. By default, it appears thanks to a shortcode, but you can customize it in awesome ways.
Most WooCommerce themes allow you to link to the “My Account” page easily. But if you’re building something more advanced or dynamic, you’ll need the Menu ID.
🔍 How to Locate the Menu ID
Let’s start by finding that Menu ID.
- Go to your WordPress Dashboard.
- Head over to Appearance > Menus.
- Select the menu that contains your “My Account” item.
- Hover over the “My Account” menu link.
- Check the browser’s status bar. Look at the URL—it should look like this:
menus&action=edit&menu-item=1234
The number is your Menu ID (in this case, 1234).
That’s it! You now hold the Menu ID. 🎉
✨ Dynamic Menus: Make “My Account” Smarter
Now that you have the ID, let’s make your menu do cool things. One popular trick is showing different links for logged-in users and guests. Why show “My Account” if the user isn’t even logged in?
Here’s how to create dynamic menu items using a tiny bit of code. Add this to your theme’s functions.php file—or better, use a custom plugin to keep things clean:
add_filter( 'wp_nav_menu_objects', 'custom_account_menu_filter', 10, 2 );
function custom_account_menu_filter( $items, $args ) {
foreach ( $items as $key => $item ) {
if ( $item->title == 'My Account' ) {
if ( is_user_logged_in() ) {
$item->title = 'Welcome Back!';
} else {
$item->title = 'Login / Register';
}
}
}
return $items;
}
With this code, your menu becomes super smart. Users see a completely different message depending on their login status.

🧩 Shortcodes: Add Magic Without Code
Shortcodes are tiny shortcuts to big functionality. To embed the “My Account” page inside any page or post, just use this:
[woocommerce_my_account]
Want to show specific info for logged-in users only? Wrap the shortcode like this:
[if_user_logged_in]
[woocommerce_my_account]
[/if_user_logged_in]
Plugins like “Shortcodes Ultimate” or “WPFront User Role Editor” can help you manage visibility like a pro. Trust us, they’re fun and handy.
🎣 Hooks: Extend WooCommerce Without Breaking it
If you want to add custom links to your “My Account” menu (like a link to a custom support page), hooks will help. WooCommerce provides several action and filter hooks for the account menu. One of the most used is:
add_filter( 'woocommerce_account_menu_items', 'add_custom_menu_item' );
function add_custom_menu_item( $items ) {
$items['support'] = 'Customer Support';
return $items;
}
Then, create a new endpoint to handle what happens when a user clicks “Customer Support”:
add_action( 'init', 'add_support_endpoint' );
function add_support_endpoint() {
add_rewrite_endpoint( 'support', EP_ROOT | EP_PAGES );
}
add_action( 'woocommerce_account_support_endpoint', 'support_content' );
function support_content() {
echo '<h2>Need Help?</h2><p>Contact us at support@example.com</p>';
}
Boom 💥! Now you’ve added your own custom menu item inside “My Account” with powerful custom content.

📊 Advanced: Target Menu Item by ID
Want to style that “My Account” menu item differently? With the Menu ID, it’s a breeze. Use CSS like this:
#menu-item-1234 {
font-weight: bold;
background-color: #f0f0f0;
border-radius: 5px;
}
You can target it visually or even hide it based on user roles using more advanced logic inside your theme templates.
🤔 Need a Plugin for All This?
Sometimes it’s just easier to use a plugin. These are great for handling dynamic menus without writing code:
- Conditional Menus: Show different menus based on login status.
- WP Menu Customizer: Add icons, roles, colors, and more.
- User Menus by Code Atlantic: A popular go-to for custom account menus.
With a plugin, you can build powerful, role-based menus and spare yourself the time of coding manually.
🛠 Bonus Tip: Hide or Redirect the Default Page
If you want to keep things clean and don’t want users accessing the account page unless logged in, use this:
add_action( 'template_redirect', 'redirect_account_if_not_logged_in' );
function redirect_account_if_not_logged_in() {
if ( is_account_page() && ! is_user_logged_in() ) {
wp_redirect( home_url() );
exit;
}
}
This sends non-logged-in visitors away from your “My Account” page. Redirect them to the home page—or better, your login/register page!

✅ Wrapping It Up
To summarize, here’s what you’ve learned today:
- How to find the Menu ID for “My Account”.
- How to use dynamic menus to show different content.
- Cool shortcodes to add or hide content.
- Hooks that customize the menu in deep ways.
- Bonus code to secure your account pages.
WooCommerce gives you all the tools—you just need to know where to look!
Once you start digging into menus, shortcodes, and hooks, a world of flexibility opens up. You can turn even the simplest shop into a personalized experience for every user. 💎
So go ahead and start experimenting. And remember… if you ever get stuck, the WooCommerce documentation has your back. Happy coding!