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