diff --git a/wp-includes/bookmark.php b/wp-includes/bookmark.php index 8248e3a64f..ab4b8c8c6b 100644 --- a/wp-includes/bookmark.php +++ b/wp-includes/bookmark.php @@ -33,11 +33,16 @@ function get_bookmark($bookmark, $output = OBJECT, $filter = 'raw') { $_bookmark = & $GLOBALS['link']; } elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark') ) { $_bookmark = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark)); - $_bookmark->link_category = array_unique( wp_get_object_terms($_bookmark->link_id, 'link_category', array('fields' => 'ids')) ); - wp_cache_add($_bookmark->link_id, $_bookmark, 'bookmark'); + if ( $_bookmark ) { + $_bookmark->link_category = array_unique( wp_get_object_terms( $_bookmark->link_id, 'link_category', array( 'fields' => 'ids' ) ) ); + wp_cache_add( $_bookmark->link_id, $_bookmark, 'bookmark' ); + } } } + if ( ! $_bookmark ) + return $_bookmark; + $_bookmark = sanitize_bookmark($_bookmark, $filter); if ( $output == OBJECT ) {