I know how to get a bookmark in wordpress by the bookmark id.
<?php $bookmark = get_bookmark(8); ?>
<a href="<?php echo $bookmark->link_url; ?>" target="_new">link</a>
How can I get it by its name instead of its id?
Thank you.
Well apart from using the $wpdb
with an SQL-query directly you could use the search
-option of get_bookmarks
:
$bookmarks = get_bookmarks(array('search' => 'link_name name'));
But it searches not only the link_name field but also other fields:
Searches link_url, link_name or link_description like the search string