Jimmy
Jimmy

Reputation: 12497

Invalid link when trying to add wordpress lost password url

I'm trying to put a link to the password reset form on wordpress. In my plugin I have this code:

$returnData .= '<a href="<?php echo wp_lostpassword_url(); ?>" title="Lost Password">Lost Password</a>';

However, on my site it gives me this URL:

http://site.co.nf/testing_site/myfolder/%3C?php%20echo%20wp_lostpassword_url();%20?%3E

Can anyone please tell me what I am doing wrong?

Upvotes: 1

Views: 200

Answers (1)

Gavin Simpson
Gavin Simpson

Reputation: 2832

You cannot show php variables in single quotes. It treates them as literlal (i.e. $a will show as $a, but in double quotes $a will show it's value.

On top of that you cannot echo after using '='.

$returnData .= "<a href='".wp_lostpassword_url()."' title='Lost Password'>Lost Password</a>"; 

should do it.

Upvotes: 2

Related Questions