Filter hook 'get_bookmarks'

in WP Core File wp-includes/bookmark.php at line 322

View Source

get_bookmarks

Filter Hook
Description
Filters the returned list of bookmarks. 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.

Hook Information

File Location wp-includes/bookmark.php View on GitHub
Hook Type Filter
Line Number 322

Hook Parameters

Type Name Description
array $bookmarks List of the cached bookmarks.
array $parsed_args An array of bookmark query arguments.

Usage Examples

Basic Usage
<?php
// Hook into get_bookmarks
add_filter('get_bookmarks', 'my_custom_filter', 10, 2);

function my_custom_filter($bookmarks, $parsed_args) {
    // Your custom filtering logic here
    return $bookmarks;
}

Source Code Context

wp-includes/bookmark.php:322 - How this hook is used in WordPress core
<?php
 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   *

PHP Documentation

<?php
/**
			 * Filters the returned list of bookmarks.
			 *
			 * 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.
			 *
			 * @since 2.1.0
			 *
			 * @see get_bookmarks()
			 *
			 * @param array $bookmarks   List of the cached bookmarks.
			 * @param array $parsed_args An array of bookmark query arguments.
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/bookmark.php
Related Hooks

Related hooks will be displayed here in future updates.