Once you have defined parent / children relationship between different post types you’ll be able to edit child data directly from the parent editor.
This is a great time-saver when parents have many children. For example, consider an artist who has many shows, or a house with many rooms.
On the parent page you will have a fields table where you can create new posts in the child post type:
The meta box on the child page lets you amend the relationship:
Creating Child Posts from the Parent Post
You can create child posts from a parent post. For example, we have implemented a post hierarchy on our real estate demo website. This means that we can have listings content types, which have room content types belonging to them.
From the listings editing page I can create all of the rooms that belong to this listing. For example, I might wish to attach a living room to a listing. I can do this by inputting the data into the table.
You can see that the above content is highlighted in yellow. This means that it is not yet saved. Click on the save button. When everything is white it means it has saved.
Now, when I go to my list of Room admin screen, I can see that the new post has been added.
You can add as many pieces of content as you want to a fields table. For the real estate demo we added five rooms to a single listing:
Each of these rows of fields creates a new room post type:
Editing Child Posts
You can edit child posts from the parent post by making changes within the fields table. Once you have edited an item it will turn yellow. Click save to save the changes.
You can also edit the child page on its own editing screen. Just click on the edit button and you’ll be redirected to the editing screen for the child page:
To delete a child page simply click the delete button. This will not just remove the relationships but will completely delete the post.
Ordering Your Fields Table
There are controls to let you order your field table. This will let you easily find child items, and is particularly useful if you have long lists of children.
Attaching Children to Parents
What if you’ve already created a room and you want to add it to a parent? You can do this by navigating to the edit screen of the child.
You’ll see the post relationship meta box, where you can make changes to the relationship:
You can learn how to practically work with post relationships in our Real Estate Listing Tutorial.