wordpress的文章查询类WP_Query
new WP_Query(string|array $query)
$query
七十多个参数
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| attachment_id | sm | int | select | default |
| author | sm | int | string | select | default |
| author_name | sm | string | select | default |
| author__in | sm | array | select | default |
| author__not_in | sm | array | select | default |
| cache_results | sm | bool | select | default |
| cat | sm | int | string | select | default |
| category__and | 分类的ID | array | select | default |
| category__in | sm | array | select | default |
| category__not_in | sm | array | select | default |
| category_name | sm | string | select | default |
| comment_count | sm | array | int | select | default |
| comment_status | sm | string | select | default |
| comments_per_page | sm | int | select | default |
| date_query | sm | array | select | default |
| day | sm | int | select | default |
| exact | sm | bool | select | default |
| fields | sm | string | select | default |
| hour | sm | int | select | default |
| ignore_sticky_posts | 是否忽略粘性帖子。 | int | bool | default | |
| m | sm | int | select | default |
| meta_compare | sm | string | select | default |
| meta_compare_key | sm | string | select | default |
| meta_key | sm | string | select | default |
| meta_query | sm | array | select | default |
| meta_value | sm | string | select | default |
| meta_value_num | sm | int | select | default |
| meta_type_key | sm | string | select | default |
| menu_order | sm | int | select | default |
| monthnum | sm | int | select | default |
| name | sm | string | select | default |
| nopaging | sm | bool | select | default |
| no_found_rows | sm | bool | select | default |
| offset | sm | int | select | default |
| order | sm | string | select | default |
| orderby | sm | string | array | select | default |
| p | sm | int | select | default |
| page | sm | int | select | default |
| paged | sm | int | select | default |
| page_id | sm | int | select | default |
| pagename | sm | string | select | default |
| perm | sm | string | select | default |
| ping_status | sm | string | select | default |
| post__in | 文章的id | array | ||
| post__not_in | sm | array | select | default |
| post_mime_type | sm | string | select | default |
| post_name__in | sm | array | select | default |
| post_parent | sm | int | select | default |
| post_parent__in | sm | array | select | default |
| post_parent__not_in | sm | array | select | default |
| post_type | sm | string | array | select | default |
| post_status | sm | string | array | select | default |
| posts_per_page | 要查询的文章数数量。使用-1获取所有文章 | int | default | |
| posts_per_archive_page | sm | int | select | default |
| s | sm | string | select | default |
| second | sm | int | select | default |
| sentence | sm | bool | select | default |
| suppress_filters | sm | bool | select | default |
| tag | sm | string | select | default |
| tag__and | sm | array | select | default |
| tag__in | sm | array | select | default |
| tag__not_in | sm | array | select | default |
| tag_id | sm | int | select | default |
| tag_slug__and | sm | array | select | default |
| tag_slug__in | sm | array | select | default |
| tax_query | sm | array | select | default |
| title | sm | string | select | default |
| update_post_meta_cache | sm | bool | select | default |
| update_post_term_cache | sm | bool | select | default |
| lazy_load_term_meta | sm | bool | select | default |
| w | sm | int | select | default |
| year | sm | int | select | default |
之前有一个showposts参数,不过自2.1版开始就被替换成了posts_per_page。






