Skip to main content Skip to navigation Skip to footer

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]

Privacy Overview

This website uses cookies so that it can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to this website and helping employees to understand which sections of the website you find most interesting and useful.

Strictly Necessary Cookies

This website uses the Stripe Payment Processor. Cookies from Stripe are required in order for this website to provide eCommerce functions, such as to accept payments.

This website uses YouTube to host and display videos relating to the operation of this plugin and forms part of the documentation. Use of cookies from YouTube is required in order to fully document or explain elements of a product.

PHPSESSID - This cookie is native to PHP applications. The cookie is used to store and identify a users' unique session ID for the purpose of managing a user's session on the website. The cookie is a session cookies and is deleted when all the browser windows are closed.