1

I got successfully the meta_value called "rwp_user_score" from another custom post-type and save it as a variable called $meta_rwp_user_score. Now, I like to update that meta-value each time the value updated by the custom post-type. The code so far:

<?php
// I'm here in the template for "provider services" and setup some variables.
// $provider_id saves the ID from my custom post type called "provider".
$provider_id = get_field('provider_id');

// $postid saves the ID from my current post-type called "provider services".
$postid = get_the_ID();

// look for that value from cpt provider and save is as a variable
$meta_rwp_user_score=get_post_meta(($provider_id),'rwp_user_score',true);

// now update that value. Before I used add_post_meta that works. But as you know, that doesn't update it like I want. How I update it correctly? So?
update_post_meta( ($postid), 'meta_rwp_user_score', $meta_rwp_user_score, true );
?>
meicelinho
  • 11
  • 1

0 Answers0