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
146                 * the full cached results.
147                 *
148                 * @since 2.1.0
149                 *
150                 * @see get_bookmarks()
151                 *
152                 * @param array $bookmarks List of the cached bookmarks.
153                 * @param array $r         An array of bookmark query arguments.
154                 */
155                return apply_filters( 'get_bookmarks', $bookmarks, $r );
156           }
157      }
158
159      if ( !is_array($cache) )
160           $cache = array();
161
162      $inclusions = '';
163      if ( !empty($include) ) {
164           $exclude = '';  //ignore exclude, category, and category_name params if using include
 
Line Code
193           $exclusions .= ')';
194
195      if ( !empty($category_name) ) {
196           if ( $category = get_term_by('name', $category_name, 'link_category') ) {
197                $category = $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      if ( ! empty($search) ) {
207           $search = esc_sql( like_escape( $search ) );
208           $search = " AND ( (link_url LIKE '%$search%') OR (link_name LIKE '%$search%') OR (link_description LIKE '%$search%') ) ";
209      }
210
211      $category_query = '';
 
Line Code
276      if ($limit != -1)
277           $query .= " LIMIT $limit";
278
279      $results = $wpdb->get_results($query);
280
281      $cache[ $key ] = $results;
282      wp_cache_set( 'get_bookmarks', $cache, 'bookmark' );
283
284      /** This filter is documented in wp-includes/bookmark.php */
285      return apply_filters( 'get_bookmarks', $results, $r );
286 }
287
288 /**
289  * Sanitizes all bookmark fields
290  *
291  * @since 2.3.0
292  *
293  * @param object|array $bookmark Bookmark row
294  * @param string $context Optional, default is 'display'. How to filter the