Skip Navigation

[Résolu] How to automatically assign parent custom post type to posts

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.

This topic contains 3 réponses, has 3 voix.

Last updated by susannaD Il y a 6 années et 9 mois.

Assigned support staff: Luo Yang.

Auteur
Publications
#299687

I am trying to assign a parent post to multiple child posts.

I have a parent custom post type and child custom post type set up. If I individually click on a child post I can scroll down and select which parent post it belongs to (as per your instructions that I have read about creating post type relationships), but I need to do this in bulk.

Is there a way to select multiple child posts and assign them all to the one parent post at once?

#299934

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

This is not possible within Types, you will need set it's parent post in individual child post.
And Types is using a custom field "_wpcf_belongs_[parent-slug]_id" to store the parent post ID, for example the parent post type is using slug "parent-cpt", then custom field slug is "_wpcf_belongs_parent-cpt_id", you can try assign multiple posts parent post by wordpress function:
update_post_meta()

More help:
http://codex.wordpress.org/Function_Reference/update_post_meta

#303028

Thanks I have a work around.

#1087489

Please share the workaround, adding posts to the relationship one at a time is beyond tedious