Posted By

tomdowning on 09/21/11


Tagged

wordpress


Versions (?)

WP all query options


 / Published in: PHP
 

  1. offset - start from post number
  2. orderby - order by id,author,title,date,modified,parent,rand,menu_order,meta_value
  3. order - ASC,DESC
  4. author - show posts from one author, use author id or name
  5.  
  6. cat (int) - use category id.
  7. category_name (string) - use category slug (NOT name).
  8. category__and (array) - use category id.
  9. category__in (array) - use category id.
  10. category__not_in (array) - use category id.
  11.  
  12. tag (string) - use tag slug.
  13. tag_id (int) - use tag id.
  14. tag__and (array) - use tag ids.
  15. tag__in (array) - use tag ids.
  16. tag__not_in (array) - use tag ids.
  17. tag_slug__and (array) - use tag slugs.
  18. tag_slug__in (array) - use tag slugs.
  19.  
  20. tax_query (array) - use taxonomy parameters (available with Version 3.1).
  21. taxonomy (string) - Taxonomy.
  22. field (string) - Select taxonomy term by ('id' or 'slug')
  23. terms (int/string/array) - Taxonomy term(s).
  24. operator (string) - Operator to test. Possible values are 'IN', 'NOT IN', 'AND'.
  25.  
  26. p (int) - use post id.
  27. name (string) - use post slug.
  28. page_id (int) - use page id.
  29. pagename (string) - use page slug.
  30. post_parent (int) - use page id. Return just the child Pages.
  31. post__in (array) - use post ids. Specify posts to retrieve.
  32. post__not_in (array) - use post ids. Specify post NOT to retrieve.
  33.  
  34. post_type (string / array) - use post types. Retrieves posts by Post Types, default value is 'post';
  35. 'post' - a post.
  36. 'page' - a page.
  37. 'revision' - a revision.
  38. 'attachment' - an attachment. The default WP_Query sets 'post_status'=>'published', but attachments default to 'post_status'=>'inherit' so you'll need to set the status to 'inherit' or 'any'.
  39. 'any' - retrieves any type except revisions and types with 'exclude_from_search' set to true.
  40.  
  41. post_status (string / array) - use post status. Retrieves posts by Post Status, default value is 'publish'.
  42. 'publish' - a published post or page.
  43. 'pending' - post is pending review.
  44. 'draft' - a post in draft status.
  45. 'auto-draft' - a newly created post, with no content.
  46. 'future' - a post to publish in the future.
  47. 'private' - not visible to users who are not logged in.
  48. 'inherit' - a revision. see get_children.
  49. 'trash' - post is in trashbin (available with Version 2.9).
  50. 'any' - retrieves any status except those from post types with 'exclude_from_search' set to true.
  51.  
  52. meta_key (string) - Custom field key.
  53. meta_value (string) - Custom field value.
  54. meta_compare (string) - Operator to test the 'meta_value'. Possible values are '!=', '>', '>=', '<', or '<='. Default value is '='.
  55.  
  56. meta_query (array) - Custom field parameters (available with Version 3.1).
  57. key (string) - Custom field key.
  58. value (string|array) - Custom field value (Note: Array support is limited to a compare value of 'IN', 'NOT IN', 'BETWEEN', or 'NOT BETWEEN')
  59. compare (string) - Operator to test. Possible values are '=', '!=', '>', '>=', '<', '<=', 'LIKE', 'NOT LIKE', 'IN', 'NOT IN', 'BETWEEN', 'NOT BETWEEN'. Default value is '='.
  60. type (string) - Custom field type. Possible values are 'NUMERIC', 'BINARY', 'CHAR', 'DATE', 'DATETIME', 'DECIMAL', 'SIGNED', 'TIME', 'UNSIGNED'. Default value is 'CHAR'.

Report this snippet  

You need to login to post a comment.