Adding two endpoints
-
Hi All, Been trying to add two endpoints on the a site for GDPR. However I can only get one working.
1. close account
2. request returnHere’s my functions.php code:
function my_custom_endpoints() { add_rewrite_endpoint( 'close-account', EP_ROOT | EP_PAGES ); add_rewrite_endpoint( 'request-return', EP_ROOT | EP_PAGES ); } add_action( 'init', 'my_custom_endpoints' ); function my_custom_query_vars( $vars ) { $vars[] = 'close-account'; $vars[] = 'request-return'; return $vars; } add_filter( 'query_vars', 'my_custom_query_vars', 0 ); function my_custom_flush_rewrite_rules() { flush_rewrite_rules(); } add_action( 'wp_loaded', 'my_custom_flush_rewrite_rules' ); function my_custom_endpoint_content() { include 'woocommerce/myaccount/close-account.php'; include 'woocommerce/myaccount/request-return.php'; } add_action( 'woocommerce_account_close-account_endpoint', 'my_custom_endpoint_content' );
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Adding two endpoints’ is closed to new replies.