Skip Navigation

[Resolved] Move content (images) from child to the parent post

This support ticket is created 6 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 6 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1143918

We migrate from Drupal 6 to WordPress with the excellent script from hidden link.

In Drupal the images were stored in a different kind of 'custom post type' and were attached to the parent post. That was correctly recognized by the migration tool. All was correctly migrated in WordPress. But somehow the relationship between child and parents is lost.

But as we want an much easier workflow I want to attach the images from the child to the parent Custom Post Type directly, without the need to have childpost. As we are talking about 2.000+ records... is there a way to run this automatically? Parent and child share the same (but not completely) the same post-title.

#1144479

Hi, are you talking about an image stored as a custom field? If so, then you can modify the corresponding postmeta entry's "post_id" value to assign it to a different post. For example, let's say the child post ID is 123, the parent post ID is 345, and the custom image field slug is "your-field-slug". In the WordPress database there is a postmeta table where custom field entries are stored. You will search this table for the row with post_id=123 and meta_key="your-field-slug". This is the entry for the custom image field for the child post. If you edit the entry row and change 123 to 345, the custom image field will no longer be associated with the child post, but will be associated with its parent post instead.

If you must do this for 2000+ records, then a custom script is probably the best approach. It's not a trivial task, because you must be able to determine the correct parent post for each child post, then find the matching postmeta entry or entries and update them. If you need professional assistance, we have a portal available for connecting with skilled independent contractors: https://toolset.com/contractors