Don't cache a non-existent link in get_bookmark(). props wonderboymusic, fixes #21159.
git-svn-id: http://core.svn.wordpress.org/trunk@21829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f54edf701a
commit
94c34141b3
|
@ -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 ) {
|
||||
|
|
Loading…
Reference in New Issue