pods_api_pre_save_pod_item
Called before any Pod item is saved for any Pod
Usage
<?php
add_filter('pods_api_pre_save_pod_item', '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
Basic Example
The usage here to target a specific Pod is for the purpose of illustration; if you are targeting a specific Pod it is probably better to use the pods_api_pre_save_pod_item_{podname} filter.
<?php
add_filter('pods_api_pre_save_pod_item', 'my_pre_save_function', 10, 2);
function my_pre_save_function($pieces, $is_new_item) {
if ( $pieces['params']->pod == 'target_pod_name' ) {
$pieces[ 'fields' ][ 'my_field' ][ 'value' ] = "some value";
}
return $pieces;
}
Action/Filter Related To
Related Actions/Filters
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.