WordPress.org

Make WordPress Core

Changeset 21829


Ignore:
Timestamp:
09/13/2012 04:41:43 PM (8 years ago)
Author:
nacin
Message:

Don't cache a non-existent link in get_bookmark(). props wonderboymusic, fixes #21159.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/bookmark.php

    r19729 r21829  
    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');
    38         }
    39     }
     36            if ( $_bookmark ) {
     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            }
     40        }
     41    }
     42
     43    if ( ! $_bookmark )
     44        return $_bookmark;
    4045
    4146    $_bookmark = sanitize_bookmark($_bookmark, $filter);
Note: See TracChangeset for help on using the changeset viewer.