I'am trying to echo a vriable, but the permalink does not work as clickable button. The permalink just displayed outside the button.

Here is my code:

$perma = the_permalink();

$valid = '<button class="btn btn-success btn-wide" href="'.$perma.'">
           Gegevens opgeslagen  <span class="glyphicon glyphicon-ok"></span>
           <a class="pull-right"><span class="label label-default">
           <span class="glyphicon glyphicon-ok"></span></span></a></p>  

$id = get_the_ID();

if($id == '2440'){
        if($current_user->google_play_gebruikersnaam != ""){
                echo $valid;

1 Answer 1


You need to use get_permalink(), which will return the URL as opposed to echo'ing it.

  • Oke that solves one problem, can you explain to me wy the permalink doesnt work with <button> and only with <a>?
    – Babidi
    Commented Apr 25, 2014 at 11:51
  • Nevermind i fixed it!
    – Babidi
    Commented Apr 25, 2014 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.