Skip to toolbar

Called before any Pod item is saved for a specific Pod.

<?php
add_filter('pods_api_pre_save_pod_item_my_pod_name', 'my_pre_save_function', 10, 2);
function my_pre_save_function($pieces, $is_new_item) {

Parameters

PARAMETER TYPE DETAILS
$pieces (array)
$is_new_item (boolean)

Examples

Change a field value

Prevent post update if a field has an undesired value

This example checks the value of a number field to ensure it is greater than zero. If it is greater than zero $pieces is returned, which allows the post to be updated. If not wp_die is used to throw an error and prevent post updating.

Additional Information

  • This is the first filter called in save_pod_item()
  • save_pod_item() (and thus, this filter) will only be called for WordPress objects if you have added one or more fields to the Pod.