WordPress.org

Make WordPress Core

Ticket #21159: bookmark-validation.diff

File bookmark-validation.diff, 891 bytes (added by wonderboymusic, 8 years ago)
  • wp-includes/bookmark.php

     
    3333                        $_bookmark = & $GLOBALS['link'];
    3434                } elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark') ) {
    3535                        $_bookmark = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark));
    36                         $_bookmark->link_category = array_unique( wp_get_object_terms($_bookmark->link_id, 'link_category', array('fields' => 'ids')) );
    37                         wp_cache_add($_bookmark->link_id, $_bookmark, 'bookmark');
     36                        if ( ! empty( $_bookmark->link_id ) ) {
     37                                $_bookmark->link_category = array_unique( wp_get_object_terms($_bookmark->link_id, 'link_category', array('fields' => 'ids')) );
     38                                wp_cache_add($_bookmark->link_id, $_bookmark, 'bookmark');                             
     39                        }
    3840                }
    3941        }
    4042