php - wp_logout_url($redirect); is not working -
i writing simple wp plugin can log user in , out. far login concerned, it's working well; cannot logout through plugin. logout doesn't work after login. have tried lot of suggested solutions none of them worked.
my code follows:
function vrm_loginout(){ if(is_user_logged_in()){ echo '<a href="<?php echo wp_logout_url($redirect); ?>" title="logout">logout</a>'; //tried next //echo '<a href="<?php echo wp_logout_url( get_permalink() )>" title="logout">logout</a>'; title="logout">logout</a>'; }else{ wp_login_form(); }//end of if }//end of function add_shortcode('vrm_loginform', 'vrm_loginout');
your syntax wrong...you have nested <?php
tag within <?php
tag. should using:
function vrm_loginout(){ if(is_user_logged_in()){ echo '<a href="' . wp_logout_url($redirect) . '" title="logout">logout</a>'; } else{ wp_login_form(); } } add_shortcode('vrm_loginform', 'vrm_loginout');
php wordpress-plugin wordpress-theming wordpress
No comments:
Post a Comment