0

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().

  • 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
3

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

It's documented in the WP_Query codex

| improve this answer | |

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.