Once you have defined parent / children relationship between different post types you will 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 Post Relationship section, where you can create new posts in the child post type:
The meta box on the child page lets you amend the relationship:
You can create child posts from a parent post. 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:
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.
There are controls to let you order your post relationship table. This will let you easily find child items, and is particularly useful if you have long lists of children.
What if you have 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 will 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.