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