I would avoid using add_rewrite_endpoint()
directly to register account page endpoints in WooCommerce. WooCommerce has a filter that you can use that make sure everything else works properly, like the endpoint title filter and calls to is_wc_endpoint_url()
.
So add the endpoint with the woocommerce_get_query_vars
filter:
add_filter(
'woocommerce_get_query_vars',
function( $query_vars ) {
$query_vars['conversations'] = 'conversations';
return $query_vars;
}
);
Note that unlike the query_vars
filter, you need to use a key when adding to the array.
Now you can set the page contents with the woocommerce_account_conversations_endpoint
hook:
add_action(
'woocommerce_account_conversations_endpoint',
function() {
// Page content here.
}
);
And the title with the woocommerce_endpoint_conversations_title
filter:
add_filter(
'woocommerce_endpoint_conversations_title',
function( $title ) {
$title="Conversations";
return $title;
}
);
And you can continue adding it to the account menu the way you are.