• Resolved a2withkids

    (@a2withkids)


    I have updated my Test Site to 7.3.1 and turned Gutenberg on. I create a new event and try to save it, and it will not publish. It stays in draft mode. In classic mode, it will publish an event.

    I have switched to 2024 and 2025 theme and disabled all other plugins and still the same behavior.

    (As side note I had added code to turn gutenberg on for Events Manager previously. But I believe that is all removed and I’m still seeing the behavior. And if I turn on classic mode, it works fine – classic editor, will publish the event.)

Viewing 3 replies - 1 through 3 (of 3 total)
  • I ran into this issue also. The first time I click on Publish it asks me to confirm, I then clicked on Publish again and it saved the event as a Draft but then when I clicked on Publish again it saved it as a Published event. This only happened the first time I created a new event after that it didn’t require the third button click when creating a new event.

    I found that if I have Gutenberg mode and try to update an event with recurrences it fails with the following error message:

    This event has validation errors and cannot be published until they are fixed: Main recurrence set times are required.

    I was able to workaround this problem with the following code snippet:

    /**
    * Intercept and bypass Events Manager Gutenberg API validation errors
    * without breaking the classic meta-box layout bindings.
    */
    add_action( 'wp_enqueue_scripts', 'wp_override_em_gutenberg_validation_response', 999 ); // Front-end if needed
    add_action( 'admin_enqueue_scripts', 'wp_override_em_gutenberg_validation_response', 999 ); // Backend editor

    function wp_override_em_gutenberg_validation_response() {
    // Only run this inside the WordPress Admin area on post editing screens
    if ( ! is_admin() ) {
    return;
    }

    // Intercept the global fetch mechanism used by apiFetch in Gutenberg
    // to force any response from the EM validation endpoint to return true.
    $override_js = "
    (function() {
    if ( window.wp && window.wp.apiFetch ) {
    const originalApiFetch = window.wp.apiFetch;
    window.wp.apiFetch = function( options ) {
    // Check if apiFetch is hitting the Events Manager validation endpoint
    if ( options && options.path && options.path.includes('em/validation') ) {
    return originalApiFetch( options ).then( function( response ) {
    // If the server rejected the snapshot, force it to valid anyway
    if ( response && response.valid === false ) {
    console.warn('[EM Patch] Bypassing REST validation error for Gutenberg updates.');
    response.valid = true;
    response.errors = [];
    }
    return response;
    });
    }
    return originalApiFetch( options );
    };
    }
    })();
    ";

    // Inject our script inline so it executes before/alongside the validation file
    wp_add_inline_script( 'wp-api-fetch', $override_js, 'after' );
    }

    You can use the Code Snippets plugin to add this code snippet.

    Plugin Author Marcus

    (@msykes)

    Hello! This should be fixed in 7.3.5

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

You must be logged in to reply to this topic.