vendredi 27 février 2015

getting blank page after redirect in wordpress

my function is attached to init action hook, and the function redirects to the same page at the end then uses exit;



add_action('init', 'login_process');
function login_process(){
//login code
wp_redirect(get_permalink());
exit;
}


If i refresh second time then the page is comming up, also if i don't use exit; then everything is working fine, but wordpress codex says we need to almost always use exit; after wp_redirect. Also if i use home_url() instead of get_permalink() then it is also working, but i want the user to stay in the same page. Basically i'm trying to use a front end login system.


Aucun commentaire:

Enregistrer un commentaire