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,

BugFu is reporting information correctly, but it stil is not saving the changes to the field. Currently, every part of the code seems to fire, with even the remote aspect working. It seems to be the part where it tries to write the change to the custom field.

The code is supposed to take the response from the remote OMDB, parse it, and save the different data sets into the custom fields. The Fields are not shared with any other custom terms.

thanks for all the help!

 function wpse_edited_term( $term_id, $tt_id, $taxonomy ) {
    // Do something.  
   $api_key = 'xxxxxx';
   $imdb = get_term_meta( $term_id, 'imdb_id', true );

$request = wp_remote_get( 'http://www.omdbapi.com/?&apikey='.$api_key.'&i='.$imdb );
  if( is_wp_error( $request ) ) {
    return false; // Bail early

$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;

update_term_meta( $term_id,'movie_premiere_date', $released);  
update_term_meta( $term_id, 'movie_detail_directors', $director);
update_term_meta( $term_id, 'film_genre', $genres);
update_term_meta( $term_id, 'movie_running_time', $runtime); 
update_term_meta( $term_id, 'country', $country); 
update_term_meta( $term_id, 'language', $language);
update_term_meta( $term_id, 'product_image', $poster);   
update_term_meta( $term_id, 'cast', $actors);


add_action( 'edit_term', 'wpse_edited_term', 10, 3 ); ```
  • Not really sure why you are using add_action('edit_termd', 'action_terms');? Should not this be add_action('edit_term', 'action_terms');? If true then you also would need to update your code in action_terms to check so the taxonomy for the term is correct. Dec 14, 2021 at 22:21
  • you are correct, it now should be add_action( 'edit_term', 'action_terms', 10, 2 ); Although that still is not working as intended.
    – Bfrye26
    Dec 15, 2021 at 16:39
  • You need to update your question and try to add more information about what is not working. Also, in the above you are using edited_term. Please try to add the code that you actually are using, which will make it much more easier for everyone to help you. Dec 15, 2021 at 20:54
  • Thanks for the note, I had changed the code to what we currently have in place. I have also added more details.
    – Bfrye26
    Dec 16, 2021 at 17:45
  • But you just have one single call to update_post_meta() where you set the actors? What is not working? What do you mean with not pushing changes? You need to edit your question and make sure to include exactly what is not working. Right now it is hard to say anything since there is no way to know what problem you currently are facing. Is the problem that the meta data called cast is not set for the current term? Dec 16, 2021 at 19:24


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.