Hello @tomtc
BadgeOS loads two js files on front-end for CKeditor
- Standard CKeditor js file
- Custom js file to call it
Their function is to add valuable formatting options to the user when submitting submission / commenting. See screenshot
Does your “new” Rich text editor looks like the same on your User Blog front-end editor?
Thread Starter
tomtc
(@tomtc)
Hi
Yes the unwanted rich text editor looks like you screen shot and messes with the UI of the front end editor. Can something bedone so that CKeditor does not load on certain pages or how do you sugggest?
Hello @tomtc
Paste the below snippet to your active theme’s functions.php file and replace the id of the page as per your requirement.
/**
* Dequeue ckeditor js on specific page
*/
function dequeue_ckeditor_front_end() {
if ( is_admin() ) {
return;
}
global $post;
if( 469 == $post->ID ) {
global $GLOBALS;
$wp_footer = $GLOBALS["wp_filter"]["wp_footer"];
if(is_object( $wp_footer ) && !empty( $wp_footer )) {
$new_array = array();
foreach( $wp_footer as $key => $frontend_script ) {
if( $key != 10 ) {
$new_array[$key] = $frontend_script;
}
}
}
$new_data = new WP_Hook;
$new_data->callbacks = $new_array;
$GLOBALS["wp_filter"]["wp_footer"] = $new_data;
$handle = 'custom_script';
$list = 'enqueued';
if (wp_script_is( $handle, $list )) {
wp_dequeue_script( 'custom_script' );
wp_deregister_script( 'custom_script' );
}
$handle = 'ck_editor_cdn';
$list = 'enqueued';
if (wp_script_is( $handle, $list )) {
wp_dequeue_script( 'ck_editor_cdn' );
wp_deregister_script( 'ck_editor_cdn' );
}
}
}
add_action( 'wp_print_scripts', 'dequeue_ckeditor_front_end', 100 );
Thread Starter
tomtc
(@tomtc)
That worked. Thank you very much!
@tomtc
Glad to hear that!
Please add a review here for us.