I’m trying to adjust the comment form on a custom post type in the admin edit page only. The end result I’m looking for is:
- Allow switching between Visual and Text editor through the tabs on the top right like the editor on a normal post/page/etc.
- Allow the Add Media button so images can be added to the comments.
- Allow the drag/drop upload of media in the comment box.
My current code is:
add_filter( 'wp_editor_settings', 'comment_editor_visual', 10, 1 );
function comment_editor_visual( $settings ){
$screen = get_current_screen();
if ( 'my-cpt' == $screen->post_type ) {
$settings['quicktags'] = true;
$settings['tinymce'] = true;
$settings['media_buttons'] = true;
$settings['drag_drop_upload'] = true;
}
return $settings;
}
This returns the comment box with the Add Media button, both the Visual and Text editor tabs, and the drag/drop feature seems to work when you drag a file into the editor section.
The Problem
When on the Visual tab, I can’t click inside the editor to add any content. Similarly, while I can use the Add Media button and the drag/drop media function to open up the media upload screen, the images I try to add don’t get added into the content area.
When I’m on the text tab I can click inside the editor and add any text content I want, including images (as HTML code <img src="">
).
I’m not receiving any JavaScript errors either so I’m sort of at a loss as to what is preventing this from working.
For the more visual folks, here is what I’m seeing.