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 2 times in this file.

Line Code
33
34      $defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '',
35           'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'include' => '', 'exclude' => '');
36      $r = array_merge($defaults, $r);
37      extract($r);
38
39      $key = md5( serialize( $r ) );
40      if ( $cache = wp_cache_get( 'get_bookmarks', 'bookmark' ) )
41           if ( isset( $cache[ $key ] ) )
42                return apply_filters('get_bookmarks', $cache[ $key ], $r );
43
44      $inclusions = '';
45      if ( !empty($include) ) {
46      $exclude = '';  //ignore exclude, category, and category_name params if using include
47      $category = '';
48      $category_name = '';
49           $inclinks = preg_split('/[\s,]+/',$include);
50           if ( count($inclinks) ) {
51                foreach ( $inclinks as $inclink ) {
 
Line Code
132      $query .= " ORDER BY $orderby $order";
133      if ($limit != -1)
134           $query .= " LIMIT $limit";
135
136      $results = $wpdb->get_results($query);
137
138      $cache[ $key ] = $results;
139      wp_cache_add( 'get_bookmarks', $cache, 'bookmark' );
140
141      return apply_filters('get_bookmarks', $results, $r);
142 }
143
144 function delete_get_bookmark_cache() {
145      wp_cache_delete( 'get_bookmarks', 'bookmark' );
146 }
147 add_action( 'add_link', 'delete_get_bookmark_cache' );
148 add_action( 'edit_link', 'delete_get_bookmark_cache' );
149 add_action( 'delete_link', 'delete_get_bookmark_cache' );
150