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