钩子文档

get_bookmarks

💡 云策文档标注

概述

get_bookmarks 是一个 WordPress 过滤器钩子,用于过滤返回的书签列表。它允许开发者在获取书签缓存结果时进行自定义修改。

关键要点

  • 这是一个过滤器钩子,名称为 'get_bookmarks',用于修改书签列表。
  • 钩子接收两个参数:$bookmarks(缓存的书签数组)和 $parsed_args(书签查询参数数组)。
  • 钩子首次评估时返回缓存的书签列表,第二次评估在传递链接分类但不存在时返回缓存列表,第三次评估返回完整的缓存结果。
  • 与 get_bookmarks() 函数相关,用于检索书签列表。
  • 自 WordPress 2.1.0 版本引入。

📄 原文内容

Filters the returned list of bookmarks.

Description

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.

See also

Parameters

$bookmarksarray
List of the cached bookmarks.
$parsed_argsarray
An array of bookmark query arguments.

Source

return apply_filters( 'get_bookmarks', $bookmarks, $parsed_args );

Changelog

Version Description
2.1.0 Introduced.