Skip to content

Instantly share code, notes, and snippets.

@sc0ttkclark
Forked from Shelob9/ahhhhh.php
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sc0ttkclark/8865418 to your computer and use it in GitHub Desktop.
Save sc0ttkclark/8865418 to your computer and use it in GitHub Desktop.
<?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