• Resolved s0c0

    (@s0c0)


    Given the following filter rest_pre_insert_{post_type} here: https://pastebin.com/raw/JQ1JY5qV I get the expected output of this for all foobar post types:

    {
    “code”: “invalid_post”,
    “message”: “Testing error display on gutenberg.”,
    “data”: {
    “status”: 400
    }
    }

    However in WordPress 6.6.1 the editor will not display the above error message. The error remains “Updating Failed” when I am expecting “Updating Failed. Testing Error display in gutenberg”.

    If this is not supposed to work, then how else can I pass custom errors when saving posts to the gutenberg editor for custom validations I want to run.

    • This topic was modified 7 months, 1 week ago by s0c0.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator threadi

    (@threadi)

    The current WordPress 6.8.2 displays the error you generated. Why are you using 6.6.1? It may be that this was not yet supported in that version.

    Thread Starter s0c0

    (@s0c0)

    Using 6.6.1 because we haven’t prioritized an upgrade in this organization just yet. Thank you for your response.

    Thread Starter s0c0

    (@s0c0)

    I verified this works in 6.7.3

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom gutenberg errors for post validations’ is closed to new replies.