Editing Custom Fields of Child Posts

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 fields table meta box for the parent page

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

the fields table 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. 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.

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 content 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 fields table 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

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:

the mouse hovers over the edit button for the room post type

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.

the field table with the column headings highlighted and a call out box that says  "click the headings to re-order"

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’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:

the fields table meta box on the child page

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

More reading on this topic