How to call code when adding WooCommerce menu items via woocommerce_account_menu_items

I’m inserting menu items similar to the code example at
https://wordpress.stackexchange.com/a/277080/137417, but I haven’t encountered endpoints before and the documentation and tutorial I’ve looked at seem a bit beyond… Presumably, there must be a way to specify a function or something to generate the output? Or somewhere to hook into.
(Or does it have to be via a template file in the theme?)

I thought maybe i should create it as a query var:

add_filter(‘query_vars’, ‘add_query_vars’);
function add_query_vars($vars) {
$vars[] = “2nd-item”;
return $vars;
}

but I’m still staring at a good old error404 when i click the link and call

…://site.com/shop/my-account/2nd-item/

Any direction much appreciated, t.i.a.

Read more here:: How to call code when adding WooCommerce menu items via woocommerce_account_menu_items

Leave a Reply

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