Skip Navigation

[Resolved] synchronize one-to-one relationship post expiration date

This support ticket is created 4 years, 10 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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+01:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Nigel 4 years, 10 months ago.

Assisted by: Nigel.

Author
Posts
#1263567

Tell us what you are trying to do?

I would like to to synchronize post expiration date. I have two post types, public listing and restricted listing. When a restricted listing goes draft(post expiration set by your form), I would like its child post Public List goes to draft too.

How can I do this?

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

hidden link

#1263737

Nigel
Supporter

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

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

Hi there

Our APIs don't include any events for when posts are expired, but you could use the standard WP hook save_post to check whether one of the restricted listing posts is being updated and to set the post status of the related public listing to have a matching status.

The official documentation for that hook is here: https://codex.wordpress.org/Plugin_API/Action_Reference/save_post

I'm not sure how your restricted and public listings are connected, but if it is via a Types relationship then you would need to use the API function toolset_get_related_post or toolset_get_related_posts to retrieve the ID of the public listing you need to update.

https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_post
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts

#1264755

It is one-to-one relationship. I am not a coder (that is a point of using Toolset for me) so I don't know how to start.
Could you possibly provide a sample code or something??

#1265201

Nigel
Supporter

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

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

Sure, but can you give me more details of the relationship?

What is the slug of the relationship, and what are the slugs of the connected post types?

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