I've created some custom endpoints which are working well. Im having real issues trying to update the endpoint page titles, Ive search a lot of examples online and nothing seems to be working.
Here is where I add the new menu item:
function knp_add_account_menu_item($items){
$user = wp_get_current_user();
if ($user->caps['supplier'] == 1 || $user->caps['administrator']) {
$items['product-submissions'] = 'Product Submissions';
}
return $items;
}
add_filter('woocommerce_account_menu_items', 'knp_add_account_menu_item', 30);
This adds a "Product Submissions" item on teh my account menu, great. Then these are the actions I use for adding the remaining endpoints.
public function start(){
add_action('init', array($this, 'knp_supplier_endpoint'));
//Add endpoint urls
add_action('woocommerce_account_product-submissions_endpoint', array($this, 'knp_product_submissions_content'));
add_action('woocommerce_account_submission-form_endpoint', array($this, 'knp_submission_form_content'));
add_action('woocommerce_account_review_endpoint', array($this, 'knp_review_content'));
add_action('woocommerce_account_delete_endpoint', array($this, 'knp_delete_content'));
}
public function knp_supplier_endpoint(){
add_rewrite_endpoint('product-submissions', EP_PAGES);
add_rewrite_endpoint('submission-form', EP_PAGES);
add_rewrite_endpoint('review', EP_PAGES);
add_rewrite_endpoint('delete', EP_PAGES);
}
Now the callbacks work fine as all the functionality etc is working on all of the end points. However, the endpoint always shows "Your Account" (changed from "My Account") as the page title no matter what filter I try to add. Could it be because Im adding this from a custom plugin perhaps. Or am I just missing something in my initial setup? TIA
the_title
filter hook to change the title?