Hi all –
We’re using acf_form to allow our users to post to our website (pending, subject to approval, etc).
When we use built-in WordPress fields or the ACF fields we create for our custom post types, it works great using ‘field_groups’ => array(ID).
What we want to do now is integrate acf_form with The Events Calendar and display the plugin-specific fields when a user posts.
How do we do this? There’s no obvious field_groups we’d include to show the Events Calendar fields … or maybe there’s something I’m missing.
Has anyone experienced this or figured out how to do it?
I have not done this but what you would need to do is something like… Create ACF fields in your group that will hold data similar to the data for the other plugin. Name them differently so that they do not interfere with the other plugin. When the post is save get the submitted values from ACF and update the fields in the other plugin. You’d have to figure out how to do this for the other plugin.
Thanks for responding, John! That does sound like an option that could work.
Maybe this is more of a general question about acf_form, but I assume that acf_form only allows you to write to
1) custom fields created in ACF, and
2) generic WordPress fields (title, content, etc.)
Is that accurate?
If so, how does acf_form identify the non-ACF fields? If I had the meta_key of a non-ACF custom field, could I write to it?
ACF does not identify acf vs non-acf fields. For example, you can create an image field with the field name of “_thumbnail_id” and ACF will save the value to the standard WP featured image field and then this image can be used by all the WP functions that deal with the featured image. I do this for example to require a featured image for posts and then disable the WP featured image meta box.
However, fields like title and content are different, these values are not stored in the postmeta table, they are stored in the post table and would not be effected.
You can create fields in ACF using the same meta_key as used by some other plugin and ACF will store the values in the correct place for that plugin.
The problem with this would be when two fields with the same name appear in the same forme. So, for example, if you were in the admin on the editor page for the events plugin and one of it’s fields was named “events_xyz” and you gave an acf field the same name and it appeared on the same admin page you will run into issues since both fields will be trying to save their values to the same place. Another issue may be that the other plugin might save the value in a different format than ACF stores the value. Another possible issue is that the other plugin does not actually store the values in the postmeta table, many plugins use custom db table. These are the reasons that I would go in the direction I mentioned, it chooses the safest path to prevent potential issues.
Can you use this method and get away with using the same field names for ACF as used in the other plugin? I cannot answer this question.
Got it — thank you for that awesome insight, John!
So to be clear about one thing — even if I know the meta_key of a field created by The Events Calendar — _EventCost, for example — I would need to create an ACF field ALSO called _EventCost in order to write to it?
That being the case, I could not include the plugin’s _EventCost field somehow within my acf_form call?
I think I have the right — does that sound correct?
The topic ‘ACF_Form and The Events Calendar’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.