diff --git a/CHANGELOG.md b/CHANGELOG.md index be1ee710e..2c3f534f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file, per [the Keep a Changelog standard](http://keepachangelog.com/). +## [ 1.4.1 ] - 2019-03-15 +### Fixed +* Improve block editor detection, correcting an issue with post saving. + ## [ 1.4.0 ] - 2019-03-07 ### Added * Clearer instructions and help text when adding an external connection. diff --git a/distributor.php b/distributor.php index 72af073dc..77dc18194 100644 --- a/distributor.php +++ b/distributor.php @@ -2,7 +2,7 @@ /** * Plugin Name: Distributor * Description: Makes it easy to syndicate and reuse content across your websites, whether inside of a multisite or across the web. - * Version: 1.4.0 + * Version: 1.4.1 * Author: 10up Inc. * Author URI: https://distributorplugin.com * License: GPLv2 or later @@ -17,7 +17,7 @@ exit; // Exit if accessed directly. } -define( 'DT_VERSION', '1.4.0-dev' ); +define( 'DT_VERSION', '1.4.1-dev' ); define( 'DT_PLUGIN_FILE', preg_replace( '#^.*plugins/(.*)$#i', '$1', __FILE__ ) ); // Define a constant if we're network activated to allow plugin to respond accordingly. diff --git a/includes/utils.php b/includes/utils.php index 24b3631b2..e656617a4 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -55,7 +55,28 @@ function is_using_gutenberg( $post ) { return false; } - return use_block_editor_for_post( $post ); + /** + * WordPress 5.0 will do a check_admin_referrer() inside the use_block_editor_for_posts(), + * and this call would fail, returns a 404 if there's custom meta box, and kills the request. + * + * Unsetting the 'meta-box-loader' in the global request would bypass that check. + */ + if ( isset( $_GET['meta-box-loader'] ) ) { + $meta_box_loader = $_GET['meta-box-loader']; + unset( $_GET['meta-box-loader'] ); + } + + $use_block_editor = use_block_editor_for_post( $post ); + + /** + * Set the $meta_box_loader back to the request, if it exists + * so other areas that rely on it would still work. + */ + if ( isset( $meta_box_loader ) ) { + $_GET['meta-box-loader'] = $meta_box_loader; + } + + return $use_block_editor; }