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:

Post relationship meta box for the parent page

The meta box on the child page lets you amend the relationship:

Post relationship meta box for the child page

You can read about setting up post relationships here.

If you can’t see the post relationship options save your page and reload.

Creating Child Posts from the Parent Post

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.

The post relationship options with the master bedroom input. You can see that the content is highlighted in yellow. This is because it is not yet saved.

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.

Did you know that you can choose which fields you wish to appear in the Post Relationship box? You can read how to do so in our creating post relationships user guide.

Now, when I go to my list of Room admin screen, I can see that the new post has been added.

The room admin screen with the living room entry listed

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:

A post relationship section with 5 rows of content – each content entry is a single room post type

Each of these rows of fields creates a new room post type:

The list of rooms that has been created

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.

The edited field is highlighted in yellow. The mouse pointed hovers over the save button
The edited field is highlighted in yellow

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:

Edit button for entry
Edit button for entry

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 post relationship table. This will let you easily find child items, and is particularly useful if you have long lists of children.

Click on headings to re-order the entries
Click on headings to re-order the entries

Ordering child items on the post relationship meta box does not make any changes to their actual order, just to how they appear on the parent post editing screen. When you are outputting your data with Views, it will disregard this order.

Attaching Children to Parents

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:

Post relationship meta box for the child page

You can learn how to practically work with post relationships in our Real Estate Listing Tutorial.

More reading on this topic