Skip Navigation

[Resolved] How to run custom code on CRED delete button press?

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 1 reply, has 2 voices.

Last updated by Minesh 1 year, 1 month ago.

Assisted by: Minesh.

Author
Posts
#2653091

I am using CRED_DELETE_POST like this

[cred-delete-post type="button" onsuccess="123" action="delete"]Delete this[/cred-delete-post]

The post gets deleted just as planned. But, I would like to run custom code during the post deletion process. How can I hook custom code with the button press for delete post?

#2653197

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Toolset offers form hook "cred_redirect_after_delete_action" you can add your custom code and check if that help you to resolve your issue.
- https://toolset.com/documentation/programmer-reference/cred-api/#cred_redirect_after_delete_action

Otherwise, you can use the standard WordPress "post_updated" hook where you have luxury to check before and after post status and you can hook in your custom code accordingly.

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

#2653923

Issue is resolved. Thank you!