0

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"

8

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

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

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' ); ?>

or

<?php echo 'string of text: '; edit_post_link( 'Edit' ); ?>
2
  • In your first example you have pass string parameter to get_edit_post_link while it must have first parameter as post_id ( interger ). – Ravinder Kumar Feb 1 '14 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 Feb 3 '14 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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