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
164                 * the full cached results.
165                 *
166                 * @since 2.1.0
167                 *
168                 * @see get_bookmarks()
169                 *
170                 * @param array $bookmarks List of the cached bookmarks.
171                 * @param array $parsed_args         An array of bookmark query arguments.
172                 */
173                return apply_filters( 'get_bookmarks', $bookmarks, $parsed_args );
174           }
175      }
176
177      if ( ! is_array( $cache ) ) {
178           $cache = array();
179      }
180
181      $inclusions = '';
182      if ( ! empty( $parsed_args['include'] ) ) {
 
Line Code
218
219      if ( ! empty( $parsed_args['category_name'] ) ) {
220           $parsed_args['category'] = get_term_by( 'name', $parsed_args['category_name'], 'link_category' );
221           if ( $parsed_args['category'] ) {
222                $parsed_args['category'] = $parsed_args['category']->term_id;
223           } else {
224                $cache[ $key ] = array();
225                wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
226                /** This filter is documented in wp-includes/bookmark.php */
227                return apply_filters( 'get_bookmarks', array(), $parsed_args );
228           }
229      }
230
231      $search = '';
232      if ( ! empty( $parsed_args['search'] ) ) {
233           $like   = '%' . $wpdb->esc_like( $parsed_args['search'] ) . '%';
234           $search = $wpdb->prepare( ' AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ', $like, $like, $like );
235      }
236
 
Line Code
311
312      $results = $wpdb->get_results( $query );
313
314      if ( 'rand()' !== $orderby ) {
315           $cache[ $key ] = $results;
316           wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
317      }
318
319      /** This filter is documented in wp-includes/bookmark.php */
320      return apply_filters( 'get_bookmarks', $results, $parsed_args );
321 }
322
323 /**
324  * Sanitizes all bookmark fields
325  *
326  * @since 2.3.0
327  *
328  * @param stdClass|array $bookmark Bookmark row
329  * @param string $context Optional, default is 'display'. How to filter the