• Add-ons
  • Blog
  • Resources
    • Documentation
    • FAQs
    • Code snippets
    • Use cases
    • Support
  • Account
    • My account
    • Checkout
    • Cart
  • English
  • French
  • Add-ons
  • Blog
  • Resources
    • Documentation
    • FAQs
    • Code snippets
    • Use cases
    • Support
  • Account
    • My account
    • Checkout
    • Cart
  • English
  • French
home/Knowledge Base/Code snippets/Changing the default page shown by the Customer Area

Changing the default page shown by the Customer Area

979 views 0 April 13, 2021

By default, the Customer Area page will take the user to his dashboard. In some cases, you may want him to land on another page such as the private files assigned to him. Use our developer tools to know the page slugs.

function cuar_change_default_customer_page( $redirect_to ) {
  // customer-private-files is the slug where we want the user to be redirected to
  return 'customer-private-files';
}
// customer-home is the slug of the redirect page we want to change
add_filter( 'cuar/routing/redirect/root-page-to-slug?slug=' . 'customer-home', 'cuar_change_default_customer_page' );

If the page you want to redirect the user to is not a Customer Area page but another standard page, you can use the more generic hook:

function cuar_change_default_customer_page_url( $redirect_to ) {
  // 120 is the ID of a standard WordPress page we want to show when the user lands on his Customer Area.
  return get_permalink( 120 );
}
// customer-home is the slug of the redirect page we want to change
add_filter( 'cuar/routing/redirect/root-page-to-url?slug=' . 'customer-home', 'cuar_change_default_customer_page_url' );

Hint: our developer tools will help you to find the slug you are looking for.

Tags:authentication

Was this helpful?

Yes  1 No
Related Articles
  • Custom admin notification’s recipients
  • Disable CSS resets and allow integration of third party plugins
  • Automatically add a user to a group
  • Changing the page shown after logout
  • Sidebars: how to disable them
  • Detect if you are on a page in the customer area
Knowledge base
  • Code snippets 25
  • Use cases 2
  • Community links 5
FAQ
  • About licences 7
  • Pre-sales questions 3
  • After-sales questions 1
  • Plugin usage 8
  • Technical questions 10
  • Payments 4
Documentations
  • Getting started
  • Using code snippets
  • The template system
  • Full documentation
Support
  • Pre-sales Enquiries
  • Main plugin support
  • Premium add-ons support
  • Feature Requests
  • Terms and conditions for sales
  • Refund policy
  • Privacy Policy
  • Legal notices
  • Copyright 2021 wp-customerarea.com. All Rights Reserved.