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
152                 * the full cached results.
153                 *
154                 * @since 2.1.0
155                 *
156                 * @see get_bookmarks()
157                 *
158                 * @param array $bookmarks List of the cached bookmarks.
159                 * @param array $r         An array of bookmark query arguments.
160                 */
161                return apply_filters( 'get_bookmarks', $bookmarks, $r );
162           }
163      }
164
165      if ( ! is_array( $cache ) ) {
166           $cache = array();
167      }
168
169      $inclusions = '';
170      if ( ! empty( $r['include'] ) ) {
 
Line Code
204      }
205
206      if ( ! empty( $r['category_name'] ) ) {
207           if ( $r['category'] = get_term_by( 'name', $r['category_name'], 'link_category' ) ) {
208                $r['category'] = $r['category']->term_id;
209           } else {
210                $cache[ $key ] = array();
211                wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
212                /** This filter is documented in wp-includes/bookmark.php */
213                return apply_filters( 'get_bookmarks', array(), $r );
214           }
215      }
216
217      $search = '';
218      if ( ! empty( $r['search'] ) ) {
219           $like   = '%' . $wpdb->esc_like( $r['search'] ) . '%';
220           $search = $wpdb->prepare( ' AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ', $like, $like, $like );
221      }
222
 
Line Code
297
298      $results = $wpdb->get_results( $query );
299
300      if ( 'rand()' !== $orderby ) {
301           $cache[ $key ] = $results;
302           wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
303      }
304
305      /** This filter is documented in wp-includes/bookmark.php */
306      return apply_filters( 'get_bookmarks', $results, $r );
307 }
308
309 /**
310  * Sanitizes all bookmark fields
311  *
312  * @since 2.3.0
313  *
314  * @param stdClass|array $bookmark Bookmark row
315  * @param string $context Optional, default is 'display'. How to filter the