钩子文档

wp_ajax_menu_quick_search_args

💡 云策文档标注

概述

本文档介绍了 wp_ajax_menu_quick_search_args 过滤器,用于在 WordPress 后台菜单快速搜索中修改查询参数。开发者可以通过此过滤器自定义搜索行为,如调整返回的帖子数量或指定搜索列。

关键要点

  • wp_ajax_menu_quick_search_args 是一个过滤器,允许修改菜单快速搜索的查询参数。
  • 参数包括 no_found_rows、update_post_meta_cache、update_post_term_cache、posts_per_page、post_type、s 和 search_columns,用于控制搜索的各个方面。
  • 此过滤器在 WordPress 6.9.0 版本中引入,主要用于 _wp_ajax_menu_quick_search() 函数中。

代码示例

$query_args = apply_filters( 'wp_ajax_menu_quick_search_args', $query_args );

📄 原文内容

Filter the menu quick search arguments.

Parameters

$argsarray
Menu quick search arguments.

  • no_found_rows boolean
    Whether to return found rows data. Default true.
  • update_post_meta_cache boolean
    Whether to update post meta cache. Default false.
  • update_post_term_cache boolean
    Whether to update post term cache. Default false.
  • posts_per_page int
    Number of posts to return. Default 10.
  • post_type string
    Type of post to return.
  • s string
    Search query.
  • search_columns array
    Which post table columns to query.

Source

$query_args = apply_filters( 'wp_ajax_menu_quick_search_args', $query_args );

Changelog

Version Description
6.9.0 Introduced.