Support

Account

Home Forums ACF PRO update_field() multiple times through functions.php

Solved

update_field() multiple times through functions.php

  • Hi everyone,

    Is it possible to check if the field is not empty to just append new data?

    Here is my code:
    if ($product_id == 1126) {
    $e_post = get_page_by_title($title, OBJECT, ‘company’);
    $epost_id = $e_post->ID;
    $member = wp_get_current_user();
    $newmember = $member->ID;
    //condition here to accept or append new member
    update_field( ‘comp_members’, $newmember, $epost_id);
    echo “Welcome, $title member.”;
    } // End of new member

    Where ACF ‘comp_members’ field can accept multiple User IDs.
    Note: append new member data not replace.

  • This seems to be working now. by using

    add_row( $selector, $value, $post_id );

    in place of:

    update_field($selector, $value, $post_id);

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

The topic ‘update_field() multiple times through functions.php’ is closed to new replies.