钩子文档

wp_link_query

💡 云策文档标注

概述

wp_link_query 是一个 WordPress 过滤器,用于修改内部链接查询返回的结果数组。它允许开发者在查询链接时自定义或调整结果数据。

关键要点

  • 过滤器名称:wp_link_query,用于过滤链接查询结果。
  • 参数:$results(查询结果数组)和 $query(WP_Query 参数数组)。
  • 结果数组结构:包含 ID、title、permalink 和 info 等字段的关联数组。
  • 相关过滤器:wp_link_query_args,用于修改查询参数。
  • 引入版本:WordPress 3.7.0。

代码示例

$results = apply_filters( 'wp_link_query', $results, $query );

📄 原文内容

Filters the link query results.

Description

Allows modification of the returned link query results.

See also

Parameters

$resultsarray
An array of associative arrays of query results.
  • ...$0 array
    • ID int
      Post ID.
    • title string
      The trimmed, escaped post title.
    • permalink string
      Post permalink.
    • info string
      A 'Y/m/d'-formatted date for 'post' post type, the 'singular_name' post type label otherwise.
$queryarray
An array of WP_Query arguments.

Source

$results = apply_filters( 'wp_link_query', $results, $query );

Changelog

VersionDescription
3.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.