I have had a go at creating an extension that allows for creating field groups programatically which in turn allows for reusable field groups and more.
Hi @zander ,
I have made a JS-workaround for exactly this. You can find the code for it starting at line 22 in this file:
https://github.com/fewagency/fewture/blob/master/backend/assets/js/acf.js
The file also holds some other ACF-functionality that may be of help. Do note that if you have a lot of fields, it may add some extra loading time since the JS have to loop over all the fields.
To anyone coming here looking for the same as I did: here’s a fork of the @erictr1ck repo. All I did was add an option to set a default value. Since I only needed it for V5 and time was short, it will only work with 5.0+. However, I kept the v4 file from the original repo so go ahead and fork my fork if you want 🙂
https://github.com/folbert/acf-hidden
Thank you Elliot,
I updated to 5.1.2 and then replaced acf_verify_nonce() with the code in the post above. Haven’t run in to the bug since then.
Just want to clarify that “It” in the sentence “It might even cause a security issue…” in my previous post is referring to my solution. I am not trying to make it sound like my solution is better form a security pow than the one @jurajk is suggesting.
I get this error as well. If i make some changes to an existing post and hit “Update” or create a new post and hit “Publish” the error occurs.
Doing a debug_backtrace, it seems to originate from acf_verify_nonce() in api/api-helpers.php where wp_verify_nonce() is called on line 1034. The value of $_POST[‘_acfnonce’] is an int with the ID of the post. The error disappears if i typecast it to a string by changing line 1034 to
if( wp_verify_nonce((string)$_POST['_acfnonce'], $nonce) )
.
This is kind of the same solution as @jurajk proposed in the previous post but it feels better to edit a plugin than WP core 🙂 It might even cause a security issue since we are validating nonces. Someone with more insight can maybe shed a light on this.
@elliot Whether the error originates from another plugin or if it’s ACF that causes the problem in the first place I do no know but if you want some more info about my setup, I’d be happy to provide it.
Thanks for an awesome, game changing, plugin!
Hi Derk,
I am also trying to do what you describe in the first post. Did you get it to work?
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.