Skip Navigation

[Resolved] Cannot overwrite WP Types field of Child through save_post hook on Parent screen

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 5 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)


This topic contains 3 replies, has 2 voices.

Last updated by Nigel 5 years, 8 months ago.

Assisted by: Nigel.


I am trying to: overwrite a value of a WP Types custom field before the post gets saved.

Link to a page where the issue can be seen: In the backend so you cannot see it.

I am trying to overwrite a WP Types field before the Save. I am using the save_post hook (with priority 50).
The CPT (tour-date) I'm using is a child of another CPT (tour-type).
This works correctly when I update the Tour-date CPT in its own Edit screen.
However, when the Tour-date is updated through the Parent Screen (Tour Type), the WP Types field value is overwritten after my change. The save_post hook does fire, because I can add a value to a non-WP Types custom field, but all WP Types custom fields that I try to modify do not work from the Parent screen.

I have even set the priority of my save_post function to 999 but still the WP Types fields get overwritten by the WP Type code and not mine.

My expectation is that it should not matter if you modify something through the Edit Post screen of a child itself or through its Parent Screen.

Reason why I need this code to work:
Version 2.2.16 and previous store a blank date field as an empty record (wpcf-start-date=""). After version 2.2.16 no custom field is stored is if the date field is empty. I need to have the blank date so my queries will work the way I have them set up.
So my solution was to add a function to the save_post where I still save an empty custom field if the start_date is empty.
I need this to work from the Parent Screen because there are many Tour Dates to be filled or updated and opening each Tour Date separately is very cumbersome for my client.

Please tell me what I need to do to modify a value of a WP Types custom field for a CPT Child that is updated from its Parent Edit Screen.



Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

You're right, there seems to be a problem here.

I have set up a site locally to test this and have found the same, that on the parent post edit screen when saving child posts it is impossible to overwrite Types when setting post meta using the save_post hook, no matter how high the priority.

I'm escalating this as I don't know of any other hook that can be used in place of save_post and it is being overwritten by Types.

I'll let you know when I hear back from the developers.


Glad you found the same. Hope to hear back from the developers soon. Thanks!



Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

I'm just doing some house-keeping of my escalated threads and notice I didn't update you to say that this should have been fixed with the main Types 3.0 release last month.

There are different hooks you can use in place of save_post.

The wpcf_relationship_save_child($child, $parent) hook should work with legacy relationships.

A new general purpose toolset_post_update($affected_post) hook should work whenever Toolset updates posts.

I suggest you dump the arguments to the debug logs when trying these out so that you can see what is available.

Sorry for the delay getting back to you, let me know if you still have problems when you try and use these.

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.