Function does not update value

Home Forums Calendar Products Events Calendar PRO Function does not update value

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1322135
    PHILLIPA
    Participant

    I wish to update a tribe events custom field called PlacesLeft using the code below. The function does not appear to work and the record is not updated?

    // Update event ID 98
    $my_post = array(

    ‘PlacesLeft’ => 46,
    );

    tribe_update_event (98, $args);

    In the database PlacesLeft is stored as a varchar

    #1322923
    Victor
    Member

    Hello Phillipa!

    Thanks for reaching out to us! 🙂 Let me try to help you with that.

    The arguments to be passed into $args can only be the ones stated here as a reference > https://developer.wordpress.org/reference/functions/wp_insert_post/#parameters

    I can see in your code that you might have mismatched the $args variable. Will something like this work for you?

    $args = array(
        'meta_input' => array(
        'PlacesLeft' => '46',
      ),
    );
    
    tribe_update_event (98, $args);
    

    I’m not sure where exactly you are using that code snippet but I suggest you test that out in a test/dev site before doing it so in a live site, because it may have unintended effects.

    We also encourage you make a full backup of your site just in case something goes wrong, and you can always revert changes back.

    I hope that helps. Let me know if you have other questions.

    Best,
    Victor

    #1332883
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Function does not update value’ is closed to new replies.