Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: get_bookmarks

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 3 times in this file.

Line Code
142                 * the full cached results.
143                 *
144                 * @since 2.1.0
145                 *
146                 * @see get_bookmarks()
147                 *
148                 * @param array $bookmarks List of the cached bookmarks.
149                 * @param array $r         An array of bookmark query arguments.
150                 */
151                return apply_filters( 'get_bookmarks', $bookmarks, $r );
152           }
153      }
154
155      if ( ! is_array( $cache ) ) {
156           $cache = array();
157      }
158
159      $inclusions = '';
160      if ( ! empty( $r['include'] ) ) {
 
Line Code
194      }
195
196      if ( ! empty( $r['category_name'] ) ) {
197           if ( $r['category'] = get_term_by('name', $r['category_name'], 'link_category') ) {
198                $r['category'] = $r['category']->term_id;
199           } else {
200                $cache[ $key ] = array();
201                wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
202                /** This filter is documented in wp-includes/bookmark.php */
203                return apply_filters( 'get_bookmarks', array(), $r );
204           }
205      }
206
207      $search = '';
208      if ( ! empty( $r['search'] ) ) {
209           $like = '%' . $wpdb->esc_like( $r['search'] ) . '%';
210           $search = $wpdb->prepare(" AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ", $like, $like, $like );
211      }
212
 
Line Code
287
288      $results = $wpdb->get_results( $query );
289
290      if ( 'rand()' !== $orderby ) {
291           $cache[ $key ] = $results;
292           wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
293      }
294
295      /** This filter is documented in wp-includes/bookmark.php */
296      return apply_filters( 'get_bookmarks', $results, $r );
297 }
298
299 /**
300  * Sanitizes all bookmark fields
301  *
302  * @since 2.3.0
303  *
304  * @param stdClass|array $bookmark Bookmark row
305  * @param string $context Optional, default is 'display'. How to filter the