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.

I have a site I'm putting together for a friend and I would like all new pages that are created to be the children of a set page (page id 495). I assume that I need to edit the meta-boxes.php file but not sure other than that.

Can anyone help me with this? I'd appreciate any comments.

Joe

share|improve this question
add comment

1 Answer

This hooks onto the wp_insert_post_data filter, and checks if the post to be inserted is both a page and an auto-draft (which happens when you first create a new post/page).

add_filter( 'wp_insert_post_data', 'wpse_59007_set_default_page_parent' );
function wpse_59007_set_default_page_parent( $data )
{
    if ( $data['post_status'] == 'auto-draft' && $data['post_type'] == 'page' )
        $data['post_parent'] = 495;
    return $data;
}
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.