wp_login_url not working

2019-08-11 10:14发布

问题:

I need to display login link for the user with redirection to home page

<?php if (!is_user_logged_in()) : ?>
        <a href="<?php wp_login_url(get_option('siteurl')); ?> "> login</a>     

However this produces the following

<a href=" "> login</a>  

What i am doing wrong?

回答1:

You need to echo it

<a href="<?php echo wp_login_url(get_option('siteurl')); ?> "> login</a> 


标签: php wordpress