Home Forums Gutenberg Required fields in Gutenberg editor


Required fields in Gutenberg editor

    • philby

    • November 16, 2018 at 8:09 pm

    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

    • philby

    • November 23, 2018 at 6:47 am

    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!

    • John O

    • November 24, 2018 at 2:25 am

    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');
    • kray

    • March 30, 2019 at 2:54 am

    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?

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

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.