How can I add hyperlink in WP_Error message?

Question

I using below code for showing error message to users in my WordPress website

if ( $wp_error ) {
    return new WP_Error( 'you_cannot_vote_on_restricted', __( 'Voting on restricted posts are not allowed.', 'anspress-question-answer' ) );
}

Now I want show error message to users with hyperlink. I use below code to do that, But this code showing just text

    if ( $wp_error ) {
return new WP_Error('no_permission', sprintf(__('<strong>ERROR</strong>: Invalid username. <a href="%s" title="Password Lost and Found">Lost your password</a>'), site_url('wp-login.php?action=lostpassword', 'login')));
}

enter image description here

This is my error message

How can I show error message to user with hyperlink?

0
Mohammad 3 months 0 Answers 14 views 0

Leave an answer