Opened 4 weeks ago
#63332 new defect (bug)
wp_editor_settings filter hook not working as expected in WordPress Admin
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 6.8 |
Component: | Comments | Keywords: | needs-patch |
Focuses: | Cc: |
Description
I am using classic editor in my local WordPress installation.
I enabled comments form in single post admin screen.
I need to show the tinymce editor inside comment form by default, so for this I used wp_editor_settings filter hook mentioned here -> https://developer.wordpress.org/reference/hooks/wp_editor_settings/.
I use the following code for enabling classic editor and showing tinymce by default in comments form:
add_filter( 'use_block_editor_for_post', 'return_false' );
add_filter( 'use_widgets_block_editor', 'return_false' );
add_action( 'wp_enqueue_scripts', function() {
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'global-styles' );
wp_dequeue_style( 'classic-theme-styles' );
}, 20 );
add_filter( 'wp_editor_settings', 'modify_call_comment_box', 10, 2 );
function modify_call_comment_box( $settings, $editor_id ) {
$settings = array(
'default_editor' => 'tinymce',
);
return $settings;
}
Issue:
When I create or edit the post and hit the Add comment button, tinymce editor in comments form is showing but I am not able to add any content inside the editor. Moreover, I can see a javascript error in the console also which shows some error in wp-includes/js/tinymce/wp-tinymce.js file.
There are no plugins installed and twenty-twenty-four theme is installed in my wordpress installation.