Programmatically write custom fields

Home Forums Calendar Products Events Calendar PRO Programmatically write custom fields

  • This topic has 3 replies, 4 voices, and was last updated 9 years ago by Bayer.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1249857
    Bayer
    Participant

    What’s the right way to get the custom fields meta key for the update_post_meta function?

    We’ve got four custom fields and this is our working code:

    
    $event_id = tribe_create_event($event_args);
    update_post_meta($event_id, '_ecp_custom_1', $event['custom1']);
    update_post_meta($event_id, '_ecp_custom_2', $event['custom2']);
    update_post_meta($event_id, '_ecp_custom_3', $event['custom3']);
    update_post_meta($event_id, '_ecp_custom_4', $event['custom4']);
    

    Now we made a new site, installed the events calendar pro plugin, added the four custom fields again and saw, that the meta keys are different: _ecp_custom_2, _ecp_custom_3, _ecp_custom_4, _ecp_custom_5. _ecp_custom_1 is missing, for whatever reason.

    Is there a more portable method?

    #1250267
    George
    Participant

    Hey Alexander,

    Thanks for reaching out.

    There is unfortunately not a more portable method for handling these fields at this. The only thing I could think of would be getting into the core plugin code which is not recommended because that itself is not very “portable”…a bit of a paradox unfortunately. 🙁

    Please let me know if this helps and if there are any other issues or questions I can try to help with!

    — George

    #1260958
    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 ‘Programmatically write custom fields’ is closed to new replies.