Skip to content

How to Trigger a Notification from a Pods Front-end Form

If you use Pods to create custom fields and want to trigger a notification off of a front-end form, you can use this code in your functions.php file as a starting point. Remember to replace ‘my_custom_pod’ in the pods_api_post_save_pod_item_ action with the name of your pod.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/**
* Update post status on save to published and trigger BNFW notification.
*
* @param array $pieces List of data.
* @param boolean $is_new_item Whether the item is new.
* @param int $id Item ID.
*/

function bnfw_pods_update_status_on_save($pieces, $is_new_item, $id) {
$post_data = array(
'ID' => $id,
'post_status' => 'publish'
);

wp_update_post($post_data);
}
add_action('pods_api_post_save_pod_item_my_custom_pod', 'bnfw_pods_update_status_on_save', 10, 3);

Subscribe for BNFW News

Want to know when new add-ons or features are released? Sign up to the newsletter. No spam, ever. Unsubscribe at any time.

Please enter your name.
Please enter a valid email address.
Something went wrong. Please check your entries and try again.