Actions and Filters
How to Trigger a Notification from a Pods Front-end Form
Updated
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.
[cc lang=”php”]
/**
* 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);
[/cc]