Support

Account

Home Forums Add-ons Repeater Field On save / update CPT A update repeater fields CPT B with Date custom post type A

Solving

On save / update CPT A update repeater fields CPT B with Date custom post type A

  • Hi there,

    Bit of a challenge here. Hopefully an creative expert can help me out.

    I have two custom post types.

    Course_date
    and
    Course

    Both custom post types contain a custom field “course_id

    Course has a repeater field (for dates).

    I’m looking for a solution for the following:

    If I add or delete a course_date post, I need the repeater field of the course post type with the same course_id to be updated. (added, updated or removed) with the dates (default WordPress dates).

    Does anyone have any idea on how to do this? (maybe other way around? If I save course, check for the course_date fields? (could resave courses with a cronjob).

    Reason I’m not just using a repeater field is for importing / updating purposes (WP All Import from google spreadsheet). And I need the repeater field for filtering purposes (WP Gridbuilder).

  • I do not have code to help you with this. Just an outline of what you need to do.

    You need to create an acf/save_post action for the course date post. Or you may need to use the WP save_post action . In your function you would do a query to find/get the course post with the same ID and then you would use add_row() to add to the repeater on the course post.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.