Get Pages with Status

Download Get Pages with Status at

This is a quick hack to the default WordPress function get_pages(). We’ve extended it to allow you to get pages that are of any status. This can be useful if you’re using WordPress as a CMS and for some reason need to display content from an unpublished page.

We add the single argument ‘status’ to the default list of arguments accepted by get_pages(). You can define status as ‘all’ (or include a specific status type if you’re so inclined). Here’s a quick example:

$getChildren = get_pages_with_status('child_of=17&status=all');
foreach($getChildren as $child) {
 $imageArray =& get_children('post_type=attachment&post_mime_type=image&orderby=menu_order&order=asc&post_parent=' . $child->ID );
 if (is_array($imageArray)) {
 foreach($imageArray as $image) {
 echo wp_get_attachment_image($image->ID, 'alternate');

The above snippet produces Real Equity Asset’s Gallery which needed to include unavailable properties.

Comments are closed