Last Updated: February 25, 2016
·
577
· zigotica

Avoid CKEditor for WordPress including crap in your head

CKEditor for WordPress has a lame bug: it hooks stuff in your markup even for non admin users, resulting in several javascript files being downloaded by your visitors. To make it worse, all in the head and blocking.

To get rid of this crap, just open ckeditor_wordpress.php and see all those add_action(…) and add_filter(…) getting initialised outside of the if (is_admin()){…} test. Move everything being at ckeditor_init() inside that admin check. This should look something like:

add_action('init', 'ckeditor_init');

function ckeditor_init(){
    if (is_admin()){
        global $ckeditor_wordpress;
        require_once 'ckeditor_class.php';
        require_once ABSPATH . 'wp-admin/includes/plugin.php';

        //all actions and filters:
        add_action(…);
        add_filter(…);
    }//end if
}

Done. You will be able to use CKEditor while creating/editing your posts, but your users will not see all that crap anymore.