WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get bookmark

Description

Retrieve Bookmark data based on bookmark link ID.

Usage

<?php get_bookmark$bookmark$output$filter ?>

Parameters

$bookmark
(integer|object) (required) Bookmark link ID or Bookmark object.
Default: None
$output
(string) (optional) Either OBJECT, ARRAY_N, or ARRAY_A constant
Default: OBJECT
$filter
(string) (optional) default is 'raw'.
Default: 'raw'

Return Values

(array|object) 
Type returned depends on $output value.

Examples

Display Bookmark Name

<?php 
$bookmark = get_bookmark(5);
echo $bookmark->link_name; 
?>

or:

<?php echo get_bookmark(5)->link_name; ?>

Display Bookmark as a Link

<?php  
$bookmark = get_bookmark(5);
echo '<a href="'.$bookmark->link_url.'">'.$bookmark->link_name.'</a>';
?>

Notes

  • Uses global: (object) $wpdb Database Object

Change Log

Since: 2.1.0

Source File

get_bookmark() is located in wp-includes/bookmark.php.

Related

get_bookmark(), get_bookmark_field(), get_bookmarks(), wp_list_bookmarks()

See also index of Function Reference and index of Template Tags.