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