Home Forums General Issues updat_field not working for postobject\'value


updat_field not working for postobject\'value

  • i have post object tht needs to be set or updated based on the text i m using update_field for the same but it doesn’t update the selected value for the post object in the post

    $allposts= get_posts(array('post_type' => 'genres', 'numberposts' => -1));
    foreach ( $allposts as $post ) :  setup_postdata($post);
    if (!empty($post))
  • Hi @littledevil

    What field type is ‘genrelist’?

    If it is a post_object or relationship field, you can’t save “MYSTERY” as the value, you instead need to save a numeric value of the post’s ID.

    If the field type is a text based field, your code should work.

    If the field ‘genrelist’ is a new field and has not yet been saved on the fields, please read over the docs below to understand why you need to use the field_key instead of the field name


Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘updat_field not working for postobject\'value’ is closed to new replies.