Home Forums Gutenberg Required fields in Gutenberg editor


Required fields in Gutenberg editor

  • Maybe (actually, quite probably) I’m doing it wrong, but so far I haven’t been able to coax any field to be required while using the Gutenberg editor (WordPress 5 Beta 4), if the fieldset position is not defined as “normal, below content”.

    Is there a way to make a field required if it is to be used in a Gutenberg Block, or as classic metadata in the somewhat more gutenbergy “side” position?

    (BTW, this might complicate things, but being old-fashioned about these kind of things I wouldn’t mind a way to tell an ACF Block to save its data to wp_postmeta instead of the data array inside the blocks html comment).

  • did you maybe find the solution I have the exact same problem, required fields no longer required with Gutenberg enabled

  • Besides putting the required field in the classic below-the-post-content position, nope.
    Haven’t tested ACF Pro 5.8 Beta 3 yet, but I’m not really expecting this to be fixed anyway.

  • thank you philby, I actually thought “classic” meant switching back to classic editor lol, I am going to give the below content position for the fields a try again, thank you!

  • I can’t see this as an open/resolved issue on Github.

    Have a look through the issues. If it’s not on there, might be worth submitting it?

  • The solution I came up with as a fix was to use jquery to disable the publish / update button if the forms on the page don’t validate. It’s only briefly tested so I wouldn’t recommend on a production site without testing.

    Make sure that this script is enqueued via file or is in <script> tags in the admin footer on the gutenberg edit page.

    jQuery(document).ready(function($) {
        $(window).bind("load", function () {
        $("form :input").change(function() {
        function switch_publish_button_on_valid(){
            } else {
                $('').attr('disabled', 'disabled');
  • Has anyone found another solution to this?

    @philby what did you mean by “Besides putting the required field in the classic below-the-post-content position” ?

    My ACF fields are below the post editor (I understand that the fields *inside* of Gutenberg blocks can’t be required But still when I attempt to publish, I get no errors if the required fields are blank.

    Is that the issue you were experiencing as well?

  • I just had our QA report this same issue. I’ll check the GitHub, hopefully this has a resolution. I hat thinking about having to go back to not using the Block Editor.

  • This is a known issue when using gutenberg editor. As far as I know there is no fix yet from ACF and waiting on any kind of a solution from WP. There is another topic around here somewhere that has the link to the list

    You can also check here

    And I found the other link as well

  • Are there any updates or workarounds available? The “known-issues” page says in “Field validation does not work in Gutenberg” that there is a fix scheduled for ACF 5.8. but I still got the same issue.

  • Bump — just curious if there’s been any progress on this deficiency?


  • Would also be interested in a solution for that issue 🙂

  • Still no solution for this. It’s kind of an important feature, eh?

  • I am not sure why this is still an issue and can only apologise for not requiring (pardon the pun) this feature earlier.

    The issue is due to the Validation not accepting anything but directly assigned fields, it ignores acf_blocks_{UNIQUE_ID}.

    So… Until ACF Dev updates the core code, add the below snippet to functions.php as a workaround. DEMO

    add_action( 'acf/validate_save_post', '_validate_save_post', 5 );
    function _validate_save_post() {
        // bail early if no $_POST
        $acf = false;
        foreach($_POST as $key => $value) {
            if (strpos($key, 'acf') === 0) {
                if (! empty( $_POST[$key] ) ) {
                    acf_validate_values( $_POST[$key], $key);
Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.