Wordpress and safe redirect urls

Hi there,

I’m setting up a subscription based system which features woo-commerce and I only want my subscribers to be able to login from a certain page.

However, woocommerce, wordpress and another plugin I am using are presenting three different login pages(they add their own pages to the top menu so I can’t control the exact url).

So my thinking was to handle the link event on the main menu when a user clicks on those pages, I used jquery preventDefault() and redirected them to the page that I wanted them to go to. This prevented the plugins from deciding and let me decide where they would go.

However, I am wondering if this is a safe url to use? Is there anything in Wordpress that would not allow me to do this:

window.location = “http://mysite.co.uk/wp-login.php?redirect_to=http%3A%2F%2Fmysite.co.uk/my-account”;

I’m presuming that this sends them to the login page (the one that I favour) and then redirects them after inputing their details to the account page?

I just need someone to confirm that this is safe because I saw some sort of server error once or twice and was worried that what I did was causing it.

thanks