WordPress codex页面 query_post 指出它不涵盖查询_post所采用的所有参数:

参数

这还不是详尽的清单。它旨在显示一些更常见的事物来设置自己的查询

我找不到所有参数的参考,即使仅以简单的列表表单为单位。此数据是否有作弊表或类似的东西?

有帮助吗?

解决方案

以下是WordPress 3.0.1的所有内容 parse_query() 功能 /wp-includes/query.php (lines 1246-1550).
但是,插件可能会添加参数,因此列表永远无法完全完成:

  • attachment
  • attachment_id
  • author
  • author_name
  • cat
  • category__and
  • category__in
  • category__not_in
  • category_name
  • comments_popup
  • day
  • error
  • feed
  • hour
  • m
  • minute
  • monthnum
  • name
  • order
  • orderby
  • p
  • page_id
  • page
  • paged
  • pagename
  • post__in
  • post__not_in
  • post_status
  • post_type
  • preview
  • robots
  • s
  • sentence
  • second
  • static
  • subpost
  • subpost_id
  • tag__and
  • tag__in
  • tag__not_in
  • tag_id
  • tag_slug__and
  • tag_slug__in
  • tag
  • taxonomy - (3.1前)
  • tb
  • term - (3.1前)
  • w
  • withcomments
  • withoutcomments
  • year

    前WP 3.1

  • meta_key
  • meta_value

    自WP 3.1以来

  • fields
  • meta_query
  • tax_query

其他提示

如果您可以阅读PHP代码,可以查看该功能 parse_query($query) 在班上 WP_Query 文件 wp-includes\query.php

支持的参数均已列出和管理。

我为WP_QUERY使用Codex页面。http://codex.wordpress.org/class_reference/wp_query

该列表可能并不详尽,但有用,相当全面且最新。我相信wp_query和query_posts共享相同的参数。

许可以下: CC-BY-SA归因
scroll top