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.

From the Codex, I'm using this function to return all children from a page ID without using SQL queries.

Usage:

<?php get_page_children( $page_id, $pages ) ?>

$page is defined as a "List of pages' objects".

What are examples of page objects I would use in this case?

share|improve this question
1  
What are you trying achieve in the end? I assume you just want to get the children of a specific page. If yes, then there are other simple methods for it. As far as I understand the codex entry, it could be page, post or custom_post_type. –  Rutwick Gangurde Nov 25 '11 at 15:50
    
I thought page and post were all part of the same $post object where page would be defined as $post->post_type='page' –  AlxVallejo Nov 25 '11 at 16:33
    
All of them are the same objects, if you do a global $post; print_r($post) on any page, you'll see it as a post object. But the type is what differentiates them. –  Rutwick Gangurde Nov 25 '11 at 17:22

1 Answer 1

up vote 1 down vote accepted

They give you an example on that page by using WP_Query to query for all pages, then get_page_children just filters that list. the "without using SQL queries" part is a bit of a misnomer, since you have to have already queried the database at some point to get those pages. if you don't already have a result to filter, then something like get_children or get_pages might be simpler.

share|improve this answer

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.