Last active
December 22, 2015 15:18
-
-
Save DrewAPicture/6491122 to your computer and use it in GitHub Desktop.
WP_Query hash notation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param array $query { | |
* WP_Query parameters. | |
* | |
* @type int 'author' Author id, or comma-separated list of ids | |
* @type string 'author_name' Use 'user_nicename' | |
* @type array 'author__in' Array of author ids to query from. | |
* @type array 'author__not_in' Array of author ids not to query from. | |
* @type int 'cat' Category id or comma-separated list of ids (this or any children) | |
* @type string 'category_name' Use category slug (not name, this or any children) | |
* @type array 'category__and' Array of category ids (AND in) | |
* @type array 'category__in' Array of category ids (OR in, no children) | |
* @type array 'category__not_in' Array of category ids (NOT in) | |
* @type string 'tag' Tag slug. Comma-separated (either), Plus-separated (all) | |
* @type int 'tag_id' Tag id or comma-separated list of ids | |
* @type array 'tag__and' Array of tag ids (AND in) | |
* @type array 'tag__in' Array of tag ids (OR in) | |
* @type array 'tag__not_in' Array of tag ids (NOT in) | |
* @type array 'tag_slug__and' Array of tag slugs (AND in) | |
* @type array 'tag_slug__in' Array of tag slugs (OR in) | |
* @type array 'tax_query' Array of WP_Tax_Query arguments. @see WP_Tax_Query. | |
* @type string 's' Search keyword. | |
* @type bool 'exact' Whether to search by exact keyword. | |
* Default false. | |
* @type bool 'sentence' Whether to search by phrase. | |
* Default false. | |
* @type array 'search_terms' Array of search terms. | |
* @type int 'menu_order' The menu order of the posts. | |
* @type int 'p' Post id. | |
* @type string 'name' Post slug. | |
* @type int 'page_id' Page id. | |
* @type string 'pagename' Page slug. | |
* @type int 'post_parent' Page id to retrieve child pages for. Use 0 to only retrieve top-level pages. | |
* @type array 'post_parent__in' Pages whose parent is in an array. | |
* @type array 'post_parent__not_in' Pages whose parent is not in an array. | |
* @type array 'post__in' Array of post ids to retrieve, sticky posts will be included. A string of comma-seperated ids will NOT work. | |
* @type array 'post__not_in' Array of post ids not to retrieve. A string of comma-seperated ids will NOT work. | |
* @type mixed 'post_type' A post type slug (string) or array of post type slugs. Default is 'any' if using tax_query. | |
* @type mixed 'post_status' A post status (string) or array of post statuses. | |
* @type bool 'nopaging' Show all posts (true) or paginate (false). | |
* Default false. | |
* @type int 'posts_per_page' The number of posts to query for. Use -1 to get all posts. | |
* @type int 'posts_per_archive_page' The number of posts to query for by archive page. Overrides 'posts_per_page' when is_archive(), or is_search() are true. | |
* @type int 'comments_per_page' The number of comments to return per page. | |
* Default 'comments_per_page' option. | |
* @type int 'comments_popup' | |
* @type int 'attachment_id' Attachmend post id. Used for 'attachment' post_type. | |
* @type string 'post_mime_type' The mime type of the post. Used for 'attachment' post_type. | |
* @type int 'offset' The number of posts to offset before retrieval. | |
* @type int 'paged' The number of the current page. | |
* @type int 'page' Show the number of posts that would show up on page X of a static front page. | |
* @type bool 'ignore_sticky_posts' Whether to ignore sticky posts or not. Setting this to false excludes stickies from 'post__in'. | |
* Default 0|false. Accepts 1|true, 0|false. | |
* @type string 'order' Designates ascending or descending order of posts. | |
* Default 'DESC'. Accepts 'ASC', 'DESC'. | |
* @type string 'orderby' Sort retrieved posts by parameter. One or more options can be passed. To use 'meta_value', or 'meta_value_num', 'meta_key=keyname' must be also be defined. | |
* Default 'date'. Accepts 'none', 'name', 'author', 'date', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand', 'comment_count'. | |
* @type array 'date_query' Array of WP_Date_Query arguments. @see WP_Date_Query. | |
* @type int 'year' The four-digit year number. | |
* Default empty. Accepts any four-digit year. | |
* @type int 'monthnum' The two-digit month number. | |
* Default empty. Accepts numbers 1-12. | |
* @type int 'w' The week number of the year. | |
* Default empty. Accepts numbers 0-53. | |
* @type int 'day' Day of the month. | |
* Default empty. Accepts numbers 1-31. | |
* @type int 'hour' Hour of the day. | |
* Default empty. Accepts numbers 0-23. | |
* @type int 'minute' Minute of the hour. | |
* Default empty. Accepts numbers 0-60. | |
* @type int 'second' Second of the minute. | |
* Default empty. Accepts numbers 0-60. | |
* @type int 'm' Combination YearMonth. | |
* Default empty. Accepts any four-digit year and month numbers 1-12. | |
* @type array 'meta_query' An array of WP_Meta_Query arguments. @see WP_Meta_Query. | |
* @type string 'meta_key' Custom field key. | |
* @type string 'meta_value' Custom field value. | |
* @type int 'meta_value_num' Custom field value number. | |
* @type string 'meta_compare' Comparison operator to test the 'meta_value'. | |
* @type string 'perm' Show posts if user has the appropriate capability. | |
* @type bool 'cache_results' Whether to cache post information. | |
* Default true. | |
* @type bool 'update_post_meta_cache' Whether to update the post meta cache. | |
* Default true. | |
* @type bool 'update_post_term_cache' Whether to update the post term cache. | |
* Default true. | |
* @type bool 'no_found_rows' Whether to count the total rows found. Disabling can improve performance. | |
* Default true. | |
* @type mixed 'fields' Which fields to return. Single field or all fields (string), or array of fields. 'id=>parent' uses 'id' and 'post_parent'. | |
* Default all fields. Accepts 'ids', 'id=>parent'. | |
* @type bool 'suppress_filters' Whether to suppress filters. | |
* Defaul false. | |
* } | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment