WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
Line | Code |
---|---|
166 | * the full cached results. |
167 | * |
168 | * @since 2.1.0 |
169 | * |
170 | * @see get_bookmarks() |
171 | * |
172 | * @param array $bookmarks List of the cached bookmarks. |
173 | * @param array $parsed_args An array of bookmark query arguments. |
174 | */ |
175 | return apply_filters( 'get_bookmarks', $bookmarks, $parsed_args ); |
176 | } |
177 | } |
178 |
|
179 | if ( ! is_array( $cache ) ) { |
180 | $cache = array(); |
181 | } |
182 |
|
183 | $inclusions = ''; |
184 | if ( ! empty( $parsed_args['include'] ) ) { |
Line | Code |
220 |
|
221 | if ( ! empty( $parsed_args['category_name'] ) ) { |
222 | $parsed_args['category'] = get_term_by( 'name', $parsed_args['category_name'], 'link_category' ); |
223 | if ( $parsed_args['category'] ) { |
224 | $parsed_args['category'] = $parsed_args['category']->term_id; |
225 | } else { |
226 | $cache[ $key ] = array(); |
227 | wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); |
228 | /** This filter is documented in wp-includes/bookmark.php */ |
229 | return apply_filters( 'get_bookmarks', array(), $parsed_args ); |
230 | } |
231 | } |
232 |
|
233 | $search = ''; |
234 | if ( ! empty( $parsed_args['search'] ) ) { |
235 | $like = '%' . $wpdb->esc_like( $parsed_args['search'] ) . '%'; |
236 | $search = $wpdb->prepare( ' AND ( (link_url LIKE %s) OR (link_name LIKE %s) OR (link_description LIKE %s) ) ', $like, $like, $like ); |
237 | } |
238 |
|
Line | Code |
313 |
|
314 | $results = $wpdb->get_results( $query ); |
315 |
|
316 | if ( 'rand()' !== $orderby ) { |
317 | $cache[ $key ] = $results; |
318 | wp_cache_set( 'get_bookmarks', $cache, 'bookmark' ); |
319 | } |
320 |
|
321 | /** This filter is documented in wp-includes/bookmark.php */ |
322 | return apply_filters( 'get_bookmarks', $results, $parsed_args ); |
323 | } |
324 |
|
325 | /** |
326 | * Sanitizes all bookmark fields. |
327 | * |
328 | * @since 2.3.0 |
329 | * |
330 | * @param stdClass|array $bookmark Bookmark row. |
331 | * @param string $context Optional. How to filter the fields. Default 'display'. |