technote0space
フォーラムへの返信
2件の返信を表示中 - 1 - 2件目 (全2件中)
-
フォーラム: バグ報告と提案
返信が含まれるトピック: プレビューに反映されないメタボックスを使用している場合、公開済みの投稿のプレビューは反映されません。
もしメタボックスを使用していて functions.php を編集することができるのであれば以下のコードで対応できる場合があります。add_filter( 'wp_insert_post_data', function ( $data ) { if ( isset( $_GET['meta-box-loader'] ) ) { unset( $data["post_modified"] ); unset( $data["post_modified_gmt"] ); } return $data; } );
または
add_action( 'save_post', function ( $post_id, $post ) { if ( isset( $_GET['meta-box-loader'] ) ) { $autosave = wp_get_post_autosave( $post_id, get_current_user_id() ); if ( $autosave ) { $filter = function ( $data ) use ( &$filter, $post ) { remove_filter( 'wp_insert_post_data', $filter ); $data["post_modified"] = gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified ) + 1 ); $data["post_modified_gmt"] = gmdate( 'Y-m-d H:i:s', strtotime( $post->post_modified_gmt ) + 1 ); return $data; }; add_filter( 'wp_insert_post_data', $filter ); wp_update_post( $autosave ); } } }, 10, 2 );
バグや解決方法の詳細は以下をご覧ください。
https://technote.space/wordpress/fix-gutenberg-previewすみません。
プラグインの開発者です。
恥ずかしながら、管理画面でしか使用できない「use_block_editor_for_post_type」を使用していたため、エラーになっていました。
自分の開発環境及びブログ等では全く関係のないプラグインによって
require_once ABSPATH . '/wp-admin/includes/post.php';
されていたため、問題なく動作しており気づきませんでした。
先ほど修正したので試していただけると幸いです。
また、エラーの報告や機能改善等はプラグインページのほうにもあるので、そちらでしたらすぐに反応できると思います。
よろしくお願いいたします。
2件の返信を表示中 - 1 - 2件目 (全2件中)