Skip Navigation

[Resolved] Call a Function When Post Expires

This support ticket is created 7 years, 2 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
- 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 2 replies, has 2 voices.

Last updated by Noriko Sugiura 7 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#567400

Hi, I have a use case and was hoping you could suggest a possible way to solve it.

When a post expires, I would like to perform some custom actions, but not just updating a field, but invoking a function that I have defined somewhere. I see that as of now, by using the cred_post_expiration_custom_actions hook, I can only update some fields.

Any idea how I can achieve this?

Thanks a lot,

#567450

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

What if you try to use the standard WordPress hook: post_updated

The scenario will be when post expiration fired it will change the post status and based on post status you should use the post_updated hook.

More info:
=> https://codex.wordpress.org/Plugin_API/Action_Reference/post_updated

#567713

Minesh, thank you so much for going the extra mile suggesting something that doesn't concert Toolset. I followed your suggestion and I think that should solve my use case. Instead of the post_updated hook, however, I am using the {old_status}_to_{new_status} hook => https://codex.wordpress.org/Post_Status_Transitions