-
-
Save sc0ttkclark/8865418 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function slug_tax_update_PRE( $pieces, $is_new_item, $id ) { | |
if ( 0 < $id ) { | |
$term = (int) $pieces[ 'fields' ][ 'tax' ][ 'value' ]; | |
wp_set_object_terms( $id, $term, 'ant', false ); | |
} | |
return $pieces; | |
} | |
//add_filter( 'pods_api_pre_save_pod_item_cpt', 'slug_tax_update_PRE', 10, 3 ); | |
function slug_tax_update_POST( $pieces, $is_new_item, $id ) { | |
$term = (int) $pieces[ 'fields' ][ 'tax' ][ 'value' ]; | |
wp_set_object_terms( $id, $term, 'ant', false ); | |
return $pieces; | |
} | |
add_filter( 'pods_api_post_save_pod_item_cpt', 'slug_tax_update_POST', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment