In WordPress, edit_bookmark_link()prints a link that opens the edit screen for one bookmark. A bookmark is an entry in the old Links Manager, a list of links such as a blogroll.
The link only appears when the current user is allowed to manage links (the manage_links capability). Visitors see nothing. Newer sites hide the Links Manager by default, so you may need the Link Manager plugin to try this function.
Syntax
Call it inside a loop that shows bookmarks. Pass the bookmark object as the fourth argument.
edit_bookmark_link() adds the Edit link for an administrator or editor.
Example 2 — Wrap the link with before and after
Use $before and $after to add a small wrapper only when the link is shown.
WordPress
<?php
edit_bookmark_link( 'Edit this link', '<p class="edit-row">', '</p>', $bookmark );
Output
<p class="edit-row"><a href="https://example.com/wp-admin/link.php?action=edit&link_id=3">Edit this link</a></p>
How It Works
The first text is the link label.
The second and third values wrap the link.
A visitor who cannot edit links sees no p tag at all.
Example 3 — Pass a bookmark ID
You can also pass a bookmark ID instead of an object.
WordPress
<?php
// Edit link for the bookmark with ID 5.
edit_bookmark_link( 'Change this link', '[ ', ' ]', 5 );
Output
[ <a href="https://example.com/wp-admin/link.php?action=edit&link_id=5">Change this link</a> ]
How It Works
5 is the bookmark ID.
WordPress builds the edit URL for that bookmark.
The square brackets only print when the link prints.
Frequently Asked Questions
It prints a link to the edit screen of one bookmark. The link shows only to users who can manage links.
Either you are not logged in as a user who can manage links, or the Links Manager is turned off. New sites hide it unless the Link Manager plugin is active.
No. It prints the link and returns nothing. To get only the URL, use get_edit_bookmark_link().
Yes, if you pass a bookmark ID or object as the fourth argument.
Yes. Visitors without permission get no output, so there is no broken link.