Title: PHP echo href problem
Last modified: August 21, 2016

---

# PHP echo href problem

 *  [jralston](https://wordpress.org/support/users/jralston/)
 * (@jralston)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/php-echo-href-problem/)
 * I am having a heck of time trying to echo a link. Here is my code:
 *     ```
       if ( ! is_user_logged_in() ) { // Display WordPress login form:
           $args = array(
               'form_id' => 'loginform-custom',
               'label_username' => __( 'Username custom text' ),
               'label_password' => __( 'Password custom text' ),
               'label_remember' => __( 'Remember Me custom text' ),
               'label_log_in' => __( 'Log In custom text' ),
               'remember' => true
           );
           wp_login_form( $args );
           wp_register('You must ', ' and login in order to post on this forum.');
           echo '<a href="' . wp_lostpassword_url() . '">Lost Password</a>';
           $url = wp_lostpassword_url('/');
           echo "<a href=$url>Click here</a>";
       } else { // If logged in:
   
           echo " Welcome! You are logged in.  |   ";
       wp_loginout( home_url() ); // Display "Log Out" link.
       }
       ```
   
 * As you can see I’ve tried 2 ways of displaying the href and neither are working.
   I have tried many different ways and none are displaying the url as clickable.
   I can echo the correct url and the “Lost Password” words – but it’s not clickable.
   I cannot get the href part of it to work. It needs to be within the if/else statement.
   Suggestions please?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/php-echo-href-problem/#post-4114226)
 * Sounds like HTML tags are being filtered for some reason. Where is this code 
   inserted?
 * (BTW, your second method is missing href quotes: `echo "<a href=\"$url\">Click
   here</a>";`)
 *  Thread Starter [jralston](https://wordpress.org/support/users/jralston/)
 * (@jralston)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/php-echo-href-problem/#post-4114253)
 * Corrected using quotes in second method, still not working.
    I inserted this 
   code into a wordpress page. Using the plugin “Allow PHP in Posts and Pages” to
   allow the use of php. Maybe the plugin is causing it? Is there a better one? 
   The source code is not showing the href code either.
 *  Thread Starter [jralston](https://wordpress.org/support/users/jralston/)
 * (@jralston)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/php-echo-href-problem/#post-4114259)
 * Solution! I used a different php plugin and it worked fine! “Shortcode Exec PHP”
   plugin seems to do the trick. Thank you to everyone for your feedback!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘PHP echo href problem’ is closed to new replies.

## Tags

 * [a href](https://wordpress.org/support/topic-tag/a-href/)
 * [href](https://wordpress.org/support/topic-tag/href/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 3 replies
 * 2 participants
 * Last reply from: [jralston](https://wordpress.org/support/users/jralston/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/php-echo-href-problem/#post-4114259)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
