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