-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wp_editor() visual tab does not work when used in meta box #40863
Comments
Hi @kblizeck, Sorry for late reply. I've tested it, but I can't reproduce this issue.
Then I prepared a minimal code for testing. // Add meta box
add_action( 'add_meta_boxes', function() {
add_meta_box(
'my_meta',
'My Meta',
function ( $post ) {
wp_nonce_field( 'my_nonce', 'my_nonce' );
$my_editor = get_post_meta( $post->ID, 'my_editor', true );
wp_editor( wp_kses_post( $my_editor ), 'my_editor' );
}
);
} );
// Update meta
add_action('save_post', function( $post_id ) {
if ( ! isset( $_POST['my_nonce'] ) ) return;
if ( ! wp_verify_nonce( $_POST['my_nonce'], 'my_nonce' ) ) return;
update_post_meta( $post_id, 'my_editor', wp_kses_post( $_POST['my_editor'] ) );
} );
// Register meta
add_action( 'init', function() {
register_post_meta( 'post', 'my_editor', [
'show_in_rest' => true,
'single' => true,
'type' => 'string',
] );
} ); Capture3bceeb98c887baa9d8148fe21a8e48ea.mp4Environment info
|
Solved the problem by adding define('CONCATENATE_SCRIPTS', false); wp-config.php |
Glad to hear that it has been resolved. If the The fact that this solved the problem means that either the theme or the plugin contained a JavaScript error, which led to this issue. To get to the root of the problem, you can check the console tab of your browser to see what is causing the issue. I think this is not Gutenberg issue, so I'll close this issue. |
@t-hamano Using a fresh WP install with the default Twenty Twenty-Three theme and no plugins, the console is producing the following error on any post/page edit screen:
If this error is blocking |
@hipwebdesign |
I can confirm that the setting "define('CONCATENATE_SCRIPTS', false);" definitely solve this problem. |
Description
Related to #5365 & #3302
Visual tab of
wp_editor
appears blank, and without ability to focus when used within a metaboxText tab shows HTML content
If you click Text tab then refresh the page, the Visual tab then loads correctly
Step-by-step reproduction instructions
add_action
for Meta box in pagewp_editor
fieldScreenshots, screen recording, code snippet
Initial load of page - Visual tab empty
Text tab view
Refresh while Text tab selected - now Visual appears as expected
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: