edit_bookmark_link() WordPress Function

The edit_bookmark_link() function allows you to create a link to edit a bookmark in WordPress. This function takes two arguments: the ID of the bookmark to edit, and the text of the link.

edit_bookmark_link( string $link = '', string $before = '', string $after = '', int $bookmark = null ) #

Displays the edit bookmark link anchor content.


Parameters

$link

(string)(Optional) Anchor text. If empty, default is 'Edit This'.

Default value: ''

$before

(string)(Optional) Display before edit link.

Default value: ''

$after

(string)(Optional) Display after edit link.

Default value: ''

$bookmark

(int)(Optional) Bookmark ID. Default is the current bookmark.

Default value: null


Top ↑

Source

File: wp-includes/link-template.php

1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark = null ) {
    $bookmark = get_bookmark( $bookmark );
 
    if ( ! current_user_can( 'manage_links' ) ) {
        return;
    }
 
    if ( empty( $link ) ) {
        $link = __( 'Edit This' );
    }
 
    $link = '<a href="' . esc_url( get_edit_bookmark_link( $bookmark ) ) . '">' . $link . '</a>';
 
    /**
     * Filters the bookmark edit link anchor tag.
     *
     * @since 2.7.0
     *
     * @param string $link    Anchor tag for the edit link.
     * @param int    $link_id Bookmark ID.
     */
    echo $before . apply_filters( 'edit_bookmark_link', $link, $bookmark->link_id ) . $after;
}


Top ↑

Changelog

Changelog
VersionDescription
2.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More