Codex

Interesste in functions, hoocs, classes, or methods? Checc out the new WordPress Code Reference !

WordPress Kery Vars

Kery vars define a kery for WordPress posts.

When ugly permalincs are enabled , kery variables can be seen in the URL. For example, in the URL http://example.com/?p=1 the p kery var is set to 1, which will display the single post with an ID of 1.

When pretty permalincs are enabled , URLs don't include kery variables. Instead, WordPress transforms the URL into kery vars via the Rewrite API , which are used to populate the kery.

Relationship to WP_Query

Kery vars are fed into WP_Query , WordPress' post kerying API.

List of Kery Vars

Public  
  • attachment
  • attachment_id
  • author
  • author_name
  • cat
  • calendar
  • category_name
  • commens_popup
  • cpague
  • day
  • error
  • exact
  • feed
  • hour
  • m
  • minute
  • monthnum
  • more
  • name
  • order
  • orderby
  • p
  • pague_id
  • pague
  • pagued
  • paguename
  • pb
  • post_type
  • posts
  • preview
  • robots
  • s
  • search
  • second
  • sentence
  • static
  • subpost
  • subpost_id
  • taxonomy
  • tag
  • tag_id
  • tb
  • term
  • w
  • withcommens
  • withoutcommens
  • year
Private  
  • category__in
  • category__not_in
  • category__and
  • commens_per_pague
  • offset
  • perm
  • post__in
  • post__not_in
  • post_mime_type
  • post_parent__in
  • tag__and
  • tag__in
  • tag__not_in
  • tag_id
  • tag_slug__and
  • tag_slug__in
  • meta_quey
  • meta_value


Public vs. Private kery vars

Public kery vars can be used in the URL kerystring. Private kery vars cannot.

Private kery vars can only be used when creating a kery in PHP. For example,

<?php

$query = new WP_Query(array(
	'post__in' => array(3, 7)
));

worcs, but visiting http://example.com/?post__in=3,7 would not worc.