[wp-hackers] get_posts() alternative for all posts, published and unpublished

Callum Macdonald lists.automattic.com at callum-macdonald.com
Mon Mar 5 04:59:47 GMT 2007


Hi Robin,

get_posts() is a template tag, thanks for the confirmation though, I'll 
whip up an SQL query.

Cheers,


Callum.

Robin Adrianse wrote:
> get_posts is, IIRC, a template tag, so it wouldn't have capabilities to
> fetch "hidden" (private, drafts, etc.) posts.
>
> I would recommend a direct SQL query.
>
> On 3/4/07, Callum Macdonald <lists.automattic.com at callum-macdonald.com>
> wrote:
>>
>> G'day,
>>
>> I'm writing a plugin that updates a custom field on all posts in a given
>> category, both published and unpublished posts, with past or future
>> dates. I can't find a way to get the get_posts() function to retrieve
>> posts that don't currently appear on the blog. That makes sense given
>> that get_posts() is a template function.
>>
>> I can't find an alternative function, nor can I figure out where
>> wp-admin/edit.php gets the list of posts. I figure it could be the wp()
>> function, but I can't find any documentation on the codex (probably on
>> account of how often the letters wp are used).
>>
>> Can anyone suggest how to approach this?
>>
>> Cheers,
>>
>>
>> Callum.
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



More information about the wp-hackers mailing list