0

We can filter our posts with a URL query string: http://mysite.com/?cat=5

We can also use a similar syntax for get_posts('cat=5') and new WP_Query('cat=5').** get_posts('param=value'); just passes the string to new WP_Query('param=value');, so it follows that these work the same.

While these all seem to have the same syntax, the URL query string supports different parameters.

  • I don't see subpost or subpost_id documented anywhere in the WP_Query class, yet it seems to do something with the URL (although I can't figure out exactly what)
  • category__in doesn't work with the URL query string.

After much searching, I finally found this site that lists the supported URL query string variables, but not sure what all of them do.

Where is the documentation for these URL query string variables?

WP_Query supports many more parameters that don't seem to be supported in the URL query. Why doesn't the URL query string just get passed directly to WP_Query?

2

Take look at official Query vars. You will see two columns and by then you will get why category__in doesn't work with the URL query string. (basically, the private keywords works only if you specify them in wp_query or so...)

About subpost, I am not a hundred percent sure, what it is. In the whole WP_Query it is mentioned only with attachments, take a look.

  • ty, never seen that page :/ – Michael Lewis Nov 13 '13 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.