get_bookmarks

Filters the returned list of bookmarks.

Description

apply_filters( 'get_bookmarks', (array) $bookmarks, (array) $r ); 

The first time the hook is evaluated in this file, it returns the cached bookmarks list. The second evaluation returns a cached bookmarks list if the link category is passed but does not exist. The third evaluation returns the full cached results.

Parameters (2)

0. $bookmarks (array)
List of the cached bookmarks.
1. $r (array)
An array of bookmark query arguments.

Usage

To run the hook, copy the example below.
  1. $bookmarks = apply_filters( 'get_bookmarks', $bookmarks, $r ); 
  2.  
  3. if ( !empty( $bookmarks ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the get_bookmarks callback 
  2. function filter_get_bookmarks( $bookmarks, $r ) { 
  3. // make filter magic happen here... 
  4. return $bookmarks
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'get_bookmarks', 'filter_get_bookmarks', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'get_bookmarks', 'filter_get_bookmarks', 10, 2 ); 

Defined (3)

The filter is defined in the following location(s).

/wp-includes/bookmark.php  
  1. return apply_filters( 'get_bookmarks', $bookmarks, $r ); 
  1. return apply_filters( 'get_bookmarks', array(), $r ); 
  1. return apply_filters( 'get_bookmarks', $results, $r );