get_edit_post_link – Echo Works, but Direct Link Fails
-
So I am writing an “Edit This” for my theme and I have a strange issue. Here is how the code currently looks:
<?php global $user_ID; if($user_ID and current_user_can('level_1')) : ?> <!-- Displays an "Edit This Post" if user can edit it --> <a href="<?php echo(get_edit_post_link()); ?>" class="urdaedit">Edit This Post</a> <?php else: ?><?php endif; ?>
But if you use:
<a href="<?php get_edit_post_link(); ?>" class="urdaedit">Edit This Post</a>
The second piece of code just shows the blog URL (https://www.domain.com/), while the first one correctly links the “Edit This” post for editing.
Why is this?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘get_edit_post_link – Echo Works, but Direct Link Fails’ is closed to new replies.