I am using WordPress twentysixteen theme. There I have created a page template. In that I have created a login form. I want to redirect a user to the next page after successful login.
I tried:
header('Location: http://website.com/my-page/');
wp_redirect(get_page_by_title('My Page'));
saying error
headers already sent