This the second tutorial and by starting it slow I am going to show you a small handy function that you will love!
This snippet allows you to redirect login users and check on what WordPress page they currently at. This is useful when you run a Membership website and want your members redirected only to the member’s area and restrict access for some users.
In the previous post, I showed you how to create a child theme and explain what type of files you can add in your child theme. One of the files is “functions.php”.
- Open your Child Theme folder and create a file called “functions.php”
- Now copy and paste the code below into your functions file.
- Replace the is_page( Your Page ID ) with the page you want. For example, when your members land on the home page and they are logged in, redirect them to the member’s area.
- To get your page ID read more here. http://bit.ly/2hu7v4J
- Replace “/dashboard” with the page you want.
- This is the slug of your page. http://bit.ly/2ypeI9s
[snippet slug=redirect-user lang=php]