Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

unable to add custom page/tab to my account woocommerce

Try adding this code to your add_action ‘init’ function.

//  Let WooCommerce add a new custom endpoint "earnings" for you
add_filter( 'woocommerce_get_query_vars', function( $vars ) {
    $vars['earnings'] = 'earnings';
    return $vars;
} );

//  Add "earnings" to the WooCommerce account menu
add_filter( 'woocommerce_account_menu_items', function( $items ) {
    $items['earnings'] = __( 'My earnings', 'your-text-domain' );
    return $items;
} );

//  Display your custom title on the new endpoint page
//  Pattern: woocommerce_endpoint_{$your_endpoint}_title
add_filter( 'woocommerce_endpoint_earnings_title', function( $title ) {
    return __( 'My earnings', 'your-text-domain' );
} );

//  Display your custom content on the new endpoint page
//  Pattern: woocommerce_account_{$your_endpoint}_endpoint
add_action( 'woocommerce_account_earnings_endpoint', function() {
    echo __( 'Hello World', 'your-text-domain' );
} );

//  Only for testing, REMOVE afterwards!
flush_rewrite_rules();

Related Posts:

  1. How to modify navigation menu of the “My Account” page in WooCommerce
  2. I need help adding a second custom menu item to the WooCommerce account area menu
  3. The cart, checkout, and shop links not getting removed
  4. Menu not adding the right items
  5. Admin: WooCommerce Navigation Menus do not show empty categories search tab
  6. Importing large product categories into wordpress menu
  7. Menu’s built in the edit theme view do not have active states set when on child pages
  8. Change “login/register” to “useraccount” when a user has logged in
  9. How does WP knows which template to use for a page
  10. Display a portion/ branch of the menu tree using wp_nav_menu()
  11. Programmatically add a Navigation menu and menu items
  12. Any docs for wp_nav_menu’s “items_wrap” argument?
  13. Customizing Only a Specific Menu using the “wp_nav_menu_items” Hook?
  14. Changing the Order of Admin Menu Sections?
  15. How make top level menu item not have link, but have sub-menus that are linked?
  16. Add ‘has_children’ class to parent li when modifying Walker_Nav_Menu
  17. Get WP Navigation Menu from REST API V2
  18. How to Hard Code Custom menu items
  19. How to add a Custom Link to a Menu with a URL that is relative to the blog URL
  20. How do I remove UL on wp_nav_menu?
  21. Retrieving a list of menu items in an array
  22. WordPress default menu in database
  23. Adding an Arbitrary Link to the Admin Menu?
  24. Dynamically exclude menu items from wp_nav_menu
  25. Add “Logout” link to navigation menu
  26. Error: Declaration of MyClass::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl()
  27. Split up wp_nav_menu with custom walker
  28. Removing container from wp_nav_menu not working
  29. Custom Nav walker display current menu item children, or siblings on no children
  30. wp_nav_menu: show menu only if one exists, otherwise show nothing
  31. Is there an easy way to replace a custom menu link with a page or post?
  32. Convert output of nav_menu items into a tree-like multidimensional array
  33. Get page IDs from nav items
  34. Add a custom walker to a menu created in a widget
  35. Using a menu walker add a custom item at the end of the menu’s items
  36. Add settings to menu items in the Customizer
  37. wp_get_nav_menu_items() not working with slug
  38. How to get current-menu-item title as variable?
  39. Error “Trying to get property of non-object” with Custom Walker for wp_nav_menu
  40. Add Class to Specific Link in Custom Menu
  41. Remove a menu item in menu
  42. Generate a Menu that Displays Child Pages using wp_list_pages() with the New Menu Functionality in WordPress 3.0?
  43. How do I get the name of a menu in WordPress?
  44. How to Add to Each Menu Link with link text to data-attr?
  45. How to manually specify the current active page with wp_nav_menu()
  46. How to count nav menu items?
  47. How Does The Walker Class Work?
  48. Add Javascript to WordPress Menu
  49. Add custom menu item using wp_nav_menu_items filter
  50. Filter wp_nav_menu()
  51. remove “edit your profile” from admin menu bar
  52. WordPress Settings API, Implementing Tabs On Custom Menu Page
  53. Adding line breaks to nav menu items
  54. Adding category ID or slug to WP Nav Menu
  55. add custom class to wp_nav_menu using filter hook nav_menu_css_class
  56. Custom ID for certain menu item?
  57. Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
  58. Check if page is in a certain menu
  59. how to create a menu with all sub categories?
  60. Making breadcrumb with wp_nav_menu
  61. Does WP REST API have a built in route for calling menu?
  62. How to avoid wp_nav_menu() ID conflict?
  63. Add data-icon input to WordPress custom menu links
  64. Registering menu with ‘Automatically add new top-level pages to this menu’ selected
  65. Why do Custom Nav Menus generate so many classes on list items? Can I manage this somehow?
  66. wp_nav_menu remove class and id from li
  67. Custom search filter causes menu and query_posts problems
  68. Unregister Nav Menu from Child-Theme
  69. How does a minimal menu walker look like?
  70. Add separator to admin submenu
  71. fall back for main menu?
  72. On which hook should I be calling register_nav_menu(s)?
  73. WordPress Shortcode in Menu Item Title
  74. register_nav_menus() won’t register menus
  75. Calling the Menu Title within wp_nav_menu array function
  76. How can I create an auto-populated menu that is automatically assigned to a location?
  77. Display only page specific sub menu items using Custom Walker
  78. How do I add a search box to the nav menu?
  79. How to get IDs for objects in menu branch?
  80. New post notification in wp_nav_menu
  81. Custom Post Types posts as submenus in Nav Menu
  82. Link to Author archive from Navigation Menus in dashboard?
  83. How to stop mobile theme inheriting desktop navigation menu?
  84. Add child pages automatically to nav menu
  85. adding some custom html code to the wp_nav_menu function
  86. WordPress Menu Custom Walker Class
  87. Show just one level of child pages, wp_list_pages woe
  88. Increase search results for Admin -> Appearance -> Menus -> Search (default is 10)
  89. How to create this custom menu walker?
  90. Removing link ” from ” menu for some “links” without JS
  91. How to change order of menu items
  92. Renaming a WordPress Admin Menu
  93. Whats the difference between current_page_item and current-menu-item
  94. Using nonce in menu item
  95. Remove unusable metaboxes in nav menu management screen
  96. Menu limit, cannot add new menu items
  97. Highlight parent menu item when child is not in menu
  98. Show current navigation path from menu
  99. Deleted pages are NOT removed from custom menus?
  100. How can I add (custom) modules to Appearance -> Menus?
Categories menus Tags account, menus, woocommerce-offtopic
How come I get internal server error even with try catch for get_the_title in functions.php?
how create an html table with all values from a serialized array in option_value

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress