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);
BugFu::log($poster);
}
add_action( 'edit_term', 'wpse_edited_term', 10, 3 ); ```
add_action('edit_termd', 'action_terms');
? Should not this beadd_action('edit_term', 'action_terms');
? If true then you also would need to update your code inaction_terms
to check so the taxonomy for the term is correct.add_action( 'edit_term', 'action_terms', 10, 2 );
Although that still is not working as intended.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.update_post_meta()
where you set the actors? What is not working? What do you mean withnot 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 calledcast
is not set for the current term?