Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Shelob9/8864346 to your computer and use it in GitHub Desktop.
Save Shelob9/8864346 to your computer and use it in GitHub Desktop.
<?php
function slug_tax_update ( $pieces ) {
//global $post;
//$post_id = $post->ID;
$post_id =$pieces[ 'params' ]->id;
$term_field = $pieces[ 'fields' ][ 'tax' ][ 'value' ];
//if ( is_array( $term_field) ) {
$terms = $term_field[ 'slug' ];
$taxonomy = 'ant';
$append = FALSE;
wp_set_object_terms( $post_id, $terms, $taxonomy, $append );
// }
return $pieces;
}
//add_filter( 'pods_api_pre_save_pod_item_cpt', 'slug_tax_update' );
function slug_tax_update_POST ( $pieces ) {
//global $post;
//$post_id = $post->ID;
$post_id =$pieces[ 'params' ]->id;
$term_field = get_post_meta( $post_id, 'tax', true );
//if ( is_array( $term_field) ) {
$terms = $term_field[ 'slug' ];
$taxonomy = 'ant';
$append = FALSE;
wp_set_object_terms( $post_id, $terms, $taxonomy, $append );
//}
return $pieces;
}
add_filter( 'pods_api_pre_save_pod_item_cpt', 'slug_tax_update_POST' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment