Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

User:Cameron/Query Variables

This article is a ROUGH DRAFT. The author is still working on this document, so please do not edit this without the author's permission. The content within this article may not yet be verified or valid. This information is subject to change.

Introduction

Query Variables are used to request particlar pages of your blog from the WordPress engine. These Query Variables are passed as parameters to the index.php sitting in the home directory of your WordPress installation and have the form:

example.com/wordpress/index.php?variable=value

Query Variable Descriptions

Still to do

  • comments_popup - ???
  • static - ???
  • feed - which feed to get: atom, rss, rss2 or rdf.
  • posts - ???
  • cat - id of category to get
  • withcomments - whether to get a comments feed or just a normal feed
  • exact - ???
  • sentence - ???
  • preview - whether to get a preview of a future post or draft, for displaying as the live preview on the write post screen
  • debug - unused, iirc
  • calendar - ???
  • paged - page num to get
  • more - ???
  • tb - bool: are we doing a trackback?
  • pb - as above with pingback
  • order - ???
  • orderby - ???


These don't work?

  • m - Unsure. Cannot find posts with ?m=3, ?m=03, ?m=mar, ?m=march

it's in yyyymmdd format. try, e.g. 20060311

  • page - Unsure. Cannot find page with ?page=12, ?page=about


Close but not complete

  • none - Returns the index page
    • Example:
    • Is: is_home()
    • Type:
    • Allowed Values:


  • p - Returns a post matching that post id
    • Example: ?p=23
    • Is: is_single()
    • Type: integer
    • Allowed Values: Any number
    • Bug: should use post_id for clarity and consistency?


  • s - Same as using search box
    • Example: ?search=happy birthday
    • Is: is_search()
    • Type: string
    • Allowed Values: Any alphanumeric


  • author - Returns author page matching on author ID
    • Example: ?author=2
    • Is: is_author()
    • Type: integer
    • Allowed Values: any alphanumeric
    • Bug: attempts search using alpha characters which cannot match anything
    • Bug: should be ?author_id for clarity and consistency


  • author_name - Returns author page matching on author name
    • Example: ?author_name=Jimmy
    • Is: is_author()
    • Type: string
    • Allowed Values: any alphanumeric


  • year - Return all posts matching that year
    • Example: ?year=2005
    • Is: is_year()
    • Type: integer
    • Allowed Values: any number


  • monthnum - Return all posts matching that month
    • Example: ?monthnum=3
    • Is: is_month()
    • Type: integer
    • Allowed Values: any number
    • Bug: should only allow between 1 - 12


  • w - Returns posts matching that week
    • Example: ?w=2
    • Is:
    • Type: integer
    • Allowed Values: any number
    • Bug: should only accept 1 - 52
    • Bug: should be ?week for consistency
    • Bug: attempts search using alpha characters which cannot match anything


  • day - Return all posts written on that day
    • Example: ?day=25
    • Is: is_day()
    • Type: integer
    • Allowed Values: any number
    • Bug: should only accept # of days in that month


  • hour - Return all posts matching that specific hour
    • Example: ?hour=7 (7 am)
    • Example: ?hour=19 (7 pm)
    • Is:
    • Type: integer
    • Allowed Values: any number
    • Note: 24 hour clock
    • Bug: should only accept 0 - 23


  • minute - Return all posts matching that specific minute
    • Example: ?minute=14
    • Is:
    • Type: integer
    • Allowed Values: any number
    • Bug: should only accept 0 - 59


  • second - Return all posts matching that specific second!
    • Example: ?second=32
    • Is:
    • Type: integer
    • Allowed Values: any number
    • Bug: should only accept 0 - 59


  • name - Returns posts matching post slug
    • Example: ?name=happy birthday
    • Is:
    • Type: string
    • Allowed Values: any alphanumeric
    • Note: Uses post slug, not post title


  • category_name - Return all post in that category
    • Example: ?category_name=book
    • Is: is_category()
    • Type: string
    • Allowed Values: any alphanumeric


  • pagename - Returns posts matching pagename
    • Example: ?pagename=about
    • Is: is_page=true
    • Type: string
    • Allowed Values: any alphanumeric
    • Note: Based on page slug, not page title


  • page_id - Returns posts matching a page ID (?page_id=10)
    • Example: ?page_id=10
    • Is: is_page('...')
    • Type: integer
    • Allowed Values: any number


  • error - Forces a specific error page?
    • Example: ?error=404
    • Is:
    • Type:
    • Allowed Values: 404, what else?