I think I found the bug. It looks like this plugin calls update_post_meta, even if there had been no change. WordPress seems to have a bug where it returns false if there was an error OR if the value was the same and therefore not updated, and the AJAX function WP_REST_Meta_Fields::update_meta_value that calls the update_metadata function that treats any false as an error, and then throws an actual error as a result. This “Safe SVG” plugin should update to check if there is a difference in meta value before calling the update_post_meta, so to not trigger the WordPress bug.
/**
* Save featured image meta data when saved
*/
function bodhi_svgs_save_featured_image_meta( $post_id, $post, $update ) {
// if gutenberg is active, disable the classic editor checkbox
if( isset($_REQUEST['hidden_post_status']) ){
$value = 0;
if ( isset( $_REQUEST['inline_featured_image'] ) ) {
$value = 1;
}
// Check if post type supports 'thumbnail' (Featured Image)
if ( post_type_supports( get_post_type( $post_id ), 'thumbnail' ) ) {
// set meta value to either 1 or 0
update_post_meta( $post_id, 'inline_featured_image', $value );
// ^^^ I believe this is the culprit
}
}
}
add_action( 'save_post', 'bodhi_svgs_save_featured_image_meta', 10, 3 );
-
This reply was modified 6 months ago by shanemac10.