I'm trying to get "string of text: Edit"

<?php echo 'string of text: ' . edit_post_link( 'Edit' ); ?>

but this outputs "Edit string of text:"

How do I make it appear in the correct order? "string of text: Edit"

2 Answers 2


Use the second parameter of edit_post_link(), the before parameter:

<?php edit_post_link( 'Edit', 'string of text: ' ); ?>

edit_post_link() echos the result already. you need to use one of the following examples:

<?php echo 'string of text: ' . get_edit_post_link( 'Edit' ); ?>


<?php echo 'string of text: '; edit_post_link( 'Edit' ); ?>
  • In your first example you have pass string parameter to get_edit_post_link while it must have first parameter as post_id ( interger ). Commented Feb 1, 2014 at 19:58
  • 2
    @Ravs - First parameter is text for the link, the ID can be optionally passed, but it's the fourth and last parameter. See the documentation here.
    – t31os
    Commented Feb 3, 2014 at 19:19

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.