Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.