Changeset 45590 for trunk/src/wp-includes/bookmark.php
- Timestamp:
- 07/02/2019 11:41:16 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/bookmark.php
r44546 r45590 35 35 if ( isset( $GLOBALS['link'] ) && ( $GLOBALS['link']->link_id == $bookmark ) ) { 36 36 $_bookmark = & $GLOBALS['link']; 37 } elseif ( ! $_bookmark = wp_cache_get( $bookmark, 'bookmark' ) ) { 38 $_bookmark = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark ) ); 39 if ( $_bookmark ) { 40 $_bookmark->link_category = array_unique( wp_get_object_terms( $_bookmark->link_id, 'link_category', array( 'fields' => 'ids' ) ) ); 41 wp_cache_add( $_bookmark->link_id, $_bookmark, 'bookmark' ); 37 } else { 38 $_bookmark = wp_cache_get( $bookmark, 'bookmark' ); 39 if ( ! $_bookmark ) { 40 $_bookmark = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark ) ); 41 if ( $_bookmark ) { 42 $_bookmark->link_category = array_unique( wp_get_object_terms( $_bookmark->link_id, 'link_category', array( 'fields' => 'ids' ) ) ); 43 wp_cache_add( $_bookmark->link_id, $_bookmark, 'bookmark' ); 44 } 42 45 } 43 46 } … … 140 143 141 144 $key = md5( serialize( $r ) ); 142 $cache = false;143 if ( 'rand' !== $r['orderby'] && $cache = wp_cache_get( 'get_bookmarks', 'bookmark' )) {145 $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ); 146 if ( 'rand' !== $r['orderby'] && $cache ) { 144 147 if ( is_array( $cache ) && isset( $cache[ $key ] ) ) { 145 148 $bookmarks = $cache[ $key ]; … … 205 208 206 209 if ( ! empty( $r['category_name'] ) ) { 207 if ( $r['category'] = get_term_by( 'name', $r['category_name'], 'link_category' ) ) { 210 $r['category'] = get_term_by( 'name', $r['category_name'], 'link_category' ); 211 if ( $r['category'] ) { 208 212 $r['category'] = $r['category']->term_id; 209 213 } else {
Note: See TracChangeset
for help on using the changeset viewer.