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.

It appears that I can only use an ID for the param post_parent whether in WP_Query or get_children

Is there a way to query for children via postnames which are more readable.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Try using the get_page_by_path() function (Codex ref).

So, something like:

$mypage = get_page_by_path( 'page-slug' );

$mypageid = ( $mypage ? $mypage->ID : '0' );

Then, the post_parent argument becomes:

'post_parent' => $mypageid

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.