The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
PHP functions that previously worked to automatically assign post titles and slugs via pods_api_pre_save_pod_item_podname no longer word. Posts are saved as Auto Draft.
Roll back to Pods 2.9.19 solves issue.
Version
3.06
Testing Instructions
This is the function in question - most recent site. I have experienced this on a half a dozen installations.
/**
* Set the title of a custom post type Pod, based on the value of other fields, in this case the field "event_date and text_location" in the Pod "date"
*
* This function only acts when a new item is created, but can be modified to act on all saves.
*/
add_filter( 'pods_api_pre_save_pod_item_date', 'slug_set_title', 10, 2);
function slug_set_title($pieces, $is_new_item) {
/*//check if is new item, if not return $pieces without making any changes - KK - this section was breaking the rest of the code
if ( ! $is_new_item ) {
return $pieces;
}*/
//make sure that all three fields are active
$fields = array( 'post_title', 'event_date', 'text_location' );
foreach( $fields as $field ) {
if ( ! isset( $pieces[ 'fields_active' ][ $field ] ) ) {
array_push ($pieces[ 'fields_active' ], $field );
}
}
//set variables for fields empty first for saftey's sake
$event_date = $text_location = '';
//get value of "event_date" if possible
if ( isset( $pieces[ 'fields' ][ 'event_date' ] ) && isset( $pieces[ 'fields'][ 'event_date' ][ 'value' ] ) && is_string( $pieces[ 'fields' ][ 'event_date' ][ 'value' ] ) ) {
$event_date = $pieces[ 'fields' ][ 'event_date' ][ 'value' ];
}
//get value of "location" if possible
if ( isset( $pieces[ 'fields' ][ 'text_location' ] ) && isset( $pieces[ 'fields'][ 'text_location' ][ 'value' ] ) && is_string( $pieces[ 'fields' ][ 'text_location' ][ 'value' ] ) ) {
$text_location = $pieces[ 'fields' ][ 'text_location' ][ 'value' ];
}
//set post title using $event_date
$pieces[ 'object_fields' ][ 'post_title' ][ 'value' ] = $event_date . ' - ' . $text_location;
//return $pieces to save
return $pieces;
}
Description
PHP functions that previously worked to automatically assign post titles and slugs via pods_api_pre_save_pod_item_podname no longer word. Posts are saved as Auto Draft.
Roll back to Pods 2.9.19 solves issue.
Version
3.06
Testing Instructions
This is the function in question - most recent site. I have experienced this on a half a dozen installations.
Site Health.txt
Screenshots / Screencast
No response
Possible Workaround
No response
Site Health Information
Pods Package