Using WordPress public query variables

Good morning.
I am trying to query various WordPress pages, using public query variables, for example

http://dmkim1979.ru/?p=37                   //  single post
http://dmkim1979.ru/?page_id=40             //  single page

But I don’t understand how to use most of these variables.
And I cannot find complete information about the subject anywhere.

Read More

The complete list of public query variables is

var $public_query_vars = array(
      'm', 'p', 'posts', 
      'w', 'cat', 
      'withcomments', 'withoutcomments', 
      's', 'search', 'exact',          
      'sentence', 'calendar', 'page', 
      'paged', 
      'more', 
      'tb', 'pb', 
      'author', 'order', 'orderby', 
      'year', 'monthnum', 'day', 
      'hour','minute', 'second', 
      'name', 'category_name', 
      'tag', 'feed', 
      'author_name', 'static', 
      'pagename', 'page_id', 'error', 
      'comments_popup', 
      'attachment', 'attachment_id', 
      'subpost', 'subpost_id', 
      'preview', 'robots', 
      'taxonomy', 'term', 'cpage',           
      'post_type');

and I managed to figure out intuitively the usage of part of them
such as

    http://dmkim1979.ru/?p=37                   //  single post
    http://dmkim1979.ru/?page_id=40             //  single page
    http://dmkim1979.ru/?paged=4                //  page 4 of 10 in archive

    http://dmkim1979.ru/?m=201310               //  10-2013 archive
    http://dmkim1979.ru/?monthnum=10            //  month 10 archive
    http://dmkim1979.ru/?year=2013              //  year archive
    http://dmkim1979.ru/?day=12                 //  daily archive (current year and month)

    http://dmkim1979.ru/?cat=3                  //  category archive
    http://dmkim1979.ru/?tag=tag4               //  tag archive
    http://dmkim1979.ru/?rating=rating4         //  custom taxonomy archive
    http://dmkim1979.ru/?post_type=tickets      //  custom post type archive
    http://dmkim1979.ru/?author=1               //  author archive by id
    http://dmkim1979.ru/?author_name=admin      //  author archive by name
    http://dmkim1979.ru/?s=uuu                  //  search archive
    http://dmkim1979.ru/?error=404              //  page not found
    http://dmkim1979.ru/?feed=rss2              //  output feed

but the others remain mysterious, such as

'posts', 'w', 'withcomments', 'withoutcomments', 'search', 'exact',          
'sentence', 'calendar', 'page', 'more', 'tb', 'pb', 
'order', 'orderby', 
'hour','minute', 'second', 
'name', 'category_name',       
'static', 
'pagename', 
'comments_popup', 
'attachment', 'attachment_id', 
'subpost', 'subpost_id', 
'preview', 'robots', 
'taxonomy', 'term', 'cpage'

can anybody please shed some light on how to use them?
(Sorry for my English.)

Related posts

2 comments

  1. In simple words – it will tell wordpress what to query (to request a data from database).

    in all of cases it will try to search a posts (no mater post this or page or other post type)

    http://dmkim.ru/?s=uuu – eq search uuu on posts (default post type post & pages) and return a results (this is search)

    http://dmkim.ru/?year=2013 – eq to archive for 2013 year (for default post types)


    this is a dirty style (non URL/SEO friendly), usually people enable url friendly mode so wp generate a internal rewite rules which transform urls like

    http://dmkim.ru/search/uuu
    http://dmkim.ru/archive/2013

    into dirty style get variables that can be easily transformed to wp_query (and generated SQL query to get posts) for your template.

Comments are closed.