WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've seen code that looks like this:

get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));

What is the definition of the p parameter and is it documented anywhere? I can't find anything about it on the Codex page for get_posts().

share|improve this question
Please use WP_Query instead of get_posts. I'm not entirely educated as to why, but I hear it's faster. – kevin conboy Jun 25 '12 at 19:39
If you don't know why, then please don't leave an answer ... take some time to read up on the differences between the functions and leave an informed response. – EAMann Jun 25 '12 at 20:19
up vote 2 down vote accepted

'p' is for querying a post, as opposed to 'page_id' for querying a page.

It's documented in the WP_Query codex

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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