Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Add target=blank in WordPress function for WP-Members

How make this code add target=_blank on return, so when user clicks they will be redirected?

add_filter( 'wpmem_forgot_link', 'my_forgot_link', 10, 2 );
function my_forgot_link( $link, $tag ) {
    // Using home_url() instead makes your filter portable.
    return 'http://test.com/wp-login.php?action=lostpassword';
}

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You should be using the wpmem_forgot_link_str hook instead, which would allow you to add target="blank" to the HTML being generated.

An example of what you’d need:

add_filter( 'wpmem_forgot_link_str', 'my_forgot_link_str', 10, 2 );
function my_forgot_link_str( $str, $link ) {
    return "<a href=\"$link\" target=\"blank\">Forgot your password?</a>";
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading