[wp-hackers] Method to retrieve all posts/pages from a blog

Volkmar Seifert vs at nifelheim.info
Tue Apr 8 14:58:33 GMT 2008


Hello all,

according the the coding-standards, one should better not attempt a direct
retrieval of data from the wordpress-database. With this in mind, I went
in search for a method retrieving all posts and pages of a blog. I found
get_posts(), but this method does not return a) only posts, no pages, and
b) not all either. The same applies for the pages.
In interest of compatibility, abstraction, and minimization of
database-requests, I would prefer a single method retrieving both, pages
and posts, of a blog - and -all-, not just a certain number, as
get_posts() does.

A bit of research showed me, as I wrote before, that such functionality
does not exist, yet. I think it would be wise to implement such a feature,
as for example the sitemap-plugins could stop attempting to harass the
database themselves. Instead they could use the appropriate function, and
with this stop the need to care about compatibility with future versions.
(In fact, the work on my own sitemap-plugin for wpmu lead me to this issue
;) ).

- Volkmar

-- 
http://blog.nifelheim.info/tech


More information about the wp-hackers mailing list