The edit_bookmark_link WordPress PHP filter allows you to modify the bookmark edit link anchor tag.
Usage
add_filter('edit_bookmark_link', 'your_custom_function', 10, 2);
function your_custom_function($link, $link_id) {
// your custom code here
return $link;
}
Parameters
$link(string) – The anchor tag for the edit link.$link_id(int) – The Bookmark ID.
More information
See WordPress Developer Resources: edit_bookmark_link
Examples
Add custom CSS class to the edit link
Add a custom CSS class to the edit link anchor tag.
add_filter('edit_bookmark_link', 'add_custom_css_class', 10, 2);
function add_custom_css_class($link, $link_id) {
return str_replace('<a ', '<a class="custom-edit-link" ', $link);
}
Add custom data attribute
Add a custom data attribute to the edit link anchor tag.
add_filter('edit_bookmark_link', 'add_custom_data_attribute', 10, 2);
function add_custom_data_attribute($link, $link_id) {
return str_replace('<a ', '<a data-custom-attr="example" ', $link);
}
Change the link text
Modify the text of the edit link anchor tag.
add_filter('edit_bookmark_link', 'change_link_text', 10, 2);
function change_link_text($link, $link_id) {
return str_replace('>Edit<', '>Modify<', $link);
}
Add custom title attribute
Add a custom title attribute to the edit link anchor tag.
add_filter('edit_bookmark_link', 'add_custom_title_attribute', 10, 2);
function add_custom_title_attribute($link, $link_id) {
return str_replace('<a ', '<a title="Edit Bookmark" ', $link);
}