Site icon Hip-Hop Website Design and Development

Save Meta when custom Taxonomy Saves

I am in need of some advice, we are setting up a custom tag for Movies. We want to have it pull from the OMDB Api when it is saved. We have the function setup, but it is not firing, and I am stumped.

I am trying to have this call when I save the custom taxonomy, so it populates the info needed for the details.

Is there is something I am missing, please let me know,

thanks for all the help!

'// define the edit_terms callback 
function action_terms($term_id) { 
   $api_key = 'xxxxxx';
  $term = $term_id;
 //$imdb_id = get_field('imdb_id', $term_id);
 $imdb = get_term_meta( $term_id, 'imdb_id', true );
 //$imdb_title = get_field('ent_imdb_title', $term_id);

  
  
$request = wp_remote_get( 'http://www.omdbapi.com/?&apikey='.$api_key.'&i='.$imdb );

$body = wp_remote_retrieve_body( $request );
$data = json_decode( $body );

$title = $data->Title;
$plot = $data->Plot;
$released = $data->Released;
$director = $data->Director;
//$genres = $data->Genre;
$runtime = $data->Runtime;
$actors = $data->Actors;
$country = $data->Country;
$language = $data->Language;
//$poster = $data->Poster;

//rwmb_set_meta( $term_id, 'description', $plot);
//rwmb_set_meta( $term_id, 'blu_review_name', $title);
rwmb_set_meta( $term, 'movie_premiere_date', $released);  
rwmb_set_meta( $term_id, 'movie_detail_directors', $director);
//rwmb_set_meta( $term_id, 'film_genre', $genres);
rwmb_set_meta( $term_id, 'movie_running_time', $runtime); 
rwmb_set_meta( $term_id, 'cast', $actors); 
//rwmb_set_meta( $term_id, 'country', $country); 
//rwmb_set_meta( $term_id, 'language', $language);
//rwmb_set_meta( $term_id, 'product_image', $poster);   
BugFu::log($actors);
}; 
         
// add the action 

add_action( 'edit_termd', 'action_terms' );