Gutenberg has been out for months but required fields from ACF still does not work on pages that uses gutenberg editor?
Does anyone know how to fix this properly? I see other similar forum threads but some of them are marked as solved without any apparent solution, whats going on here?
I don’t feel its clear anywhere that ACF does not work properly with latest wordpress (since it’s based on gutenberg) and has not since WP 5.0 released back in late 2018. It says the ACF works on WordPress 4.7.0 or higher but this is simply not true?
I would be very thankful for a more indepth answer on why ACF has not been patched to fix this (in my opinion) major issue? (Please use big words, i’m a dev)
I’ve been told via support that it is being worked on. I don’t understand this at all, especially for a paid plugin – shouldn’t there be some clear discussion of the problem? an ETA on a fix?
Are other people able to use this plugin? It seems like the one thing this plugin does ( add custom fields ) isn’t working.
The issue is the way that the new editor saves posts. Because of this the ACF validation cannot be run because the devs of the new editor with their infinite wisdom, have not provided a hook or mechanism of any kind that allows ACF to run any validation on the custom fields before the post is saved and/or prevent the post from being saved if anything fails. Elliot is working on this and he has been communicating the problem with the WP devs.
Validation happens on the server yes, but it is fired using JS. ACF intercepts the form submission using JS, it sends an AJAX request to validate, if validation fails ACF prevents the post from being saved. It is the last part that is a problem. There is nothing in the new editor that can prevent it from saving, there is nothing that will stop it from saving, at least this is my understanding. Beyond that you’d need to talk directly with Elliot.
Validation when using the new editor does not work, other than this there are a few other minor issues when using the block editor. If you want to use the block editor then my suggestion for would be to find a way to not use required fields and make sure that the site works even if the information is not added. This is the way I code anyway and I try to do this because my clients sometimes have a hard time with “required fields”. So instead of requiring a value in a field I write my template code to check if the value is available and do different things depending on that. I hard code a “default value” that will be used if they do not enter a value. I put this information about what value will be used by default in the field’s instructions. Even if you set a field to be required it is, in my opinion, a bad idea to assume the field will have a value. What if the field is added after a post is created? That old post will not even have the field and it will not have a value. What if, somehow, that value gets deleted because of an error? Best practices when coding are to always validate all data.
That being said, I still use ACF without issue, but then again I am not using the new block editor and I will likely never use the new block editor. It is not what my clients need or want. I do not build websites for people that want to, or should be allowed to, tweak the design of the site or its content. I build sites for companies where the design of every element is predetermined and fixed so that every page has a consistent look. 99.9% of my clients do not want to worry about or learn how to deal with content layout, they simply want to add content. I install classic editor on the site and then, beleive it or not, I do not use that either. I use nothing but ACF fields and I use an ACF WYSIWYG editor to replace the classic editor.
You must be logged in to reply to this topic.
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!