Home › Forums › General Issues › Insert a new Custom Post Type with populated ACF fields via code › Reply To: Insert a new Custom Post Type with populated ACF fields via code
Ok thanks wube – interesting reading. Seems to be a common problem, would be great if there was a function as you say (seems crazy that you can have keys with duplicate names in WordPress; also, not sure why performance is such a concern – things are fast as they are, it’s only relevant on inserts that happen infrequently and once-off, and if people want it fast then they should be fully hand-coding it – apart from anything else, as I see it this plugin is a massive development time saver).
The burning ‘issue’ then in my opinion is that some documentation of an actual working example of how to do this would be super useful, and save a lot of people a lot of headaches.
I have read the documentation multiple times but still not clear what I’m doing different. I will have to thus keep using the
add_post_meta() function as well, because I can’t otherwise tell the client that each time someone submits an Idea that their Admins have to go to the WP Dashboard, edit the new Idea, and hit the ‘Update’ button just for it to appear properly on the website.
Perhaps it’s because the field ‘keys’ were named similarly (but not identical) to the field ‘names’ (as I mentioned in my first post).
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!
The ACF site is currently experiencing some issues.— Advanced Custom Fields (@wp_acf) September 21, 2022
We apologize for the inconvenience and we are working hard to get it back up and running as soon as possible.
© 2022 Advanced Custom Fields.