Skip Navigation

[Resolved] How to make it a child post saved as draft or instead of automatically published

This support ticket is created 2 years, 12 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 3 replies, has 3 voices.

Last updated by Minesh 2 years, 12 months ago.

Assisted by: Minesh.

Author
Posts
#2276021
Screenshot 2022-01-26 at 5.00.36 pm.png

Tell us what you are trying to do
Make a child post added via the parent editor (see attached) when saved not to be published automatically, but instead can we make it as draft or publish after 72 hours.

Is there any documentation that you are following?
Just the one to many relationship set-up

Is there a similar example that we can see?
N/A

What is the link to your site?
N/A

#2276333

Nigel
Supporter

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

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

Hi Justin

There aren't any settings, nor a Toolset API hook where you could intervene in adding a related post through the normal back-end post edit screens to make new related posts have a draft or pending status.

To change the status you would need to use the WP API itself, e.g. the save_post hook (or, better, the CPT version of that hook), to trigger a script where you could check if you were on the post edit screen for the parent post (via get_current_screen) and if so change the status (or push the publish date forward) for the child post.

#2277333

Hi Nigel,

It’s Grace here, contacting on behalf of Eugene/Justin.
I will see if I can figure out the WP API save_post hook or find an alternative method.

May I leave this ticket open for now until then?

Thanks!

#2277449

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Here with the following link you will find the example how you can use the save_post hook:
- https://toolset.com/documentation/customizing-sites-using-php/updating-types-fields-using-php/