Tips & Tricks

1. Writing WordPress plugins compatible with CKEditor plugin

If you have ever worked on a plugin that used mce_plugins or mce_buttons filters, then you should easily do exactly the same thing with CKEditor.


Passes in/out a php array with the button names


Passes in/out an associative php array 'plugin_name' => 'plugin_url'. The url should be absolute and on the same domain as your WordPress installation.



add_filter( 'ckeditor_external_plugins', array(&$myplugin, 'ckeditor_plugin') );
add_filter( 'ckeditor_buttons', array(&$myplugin, 'ckeditor_buttons') );


class myplugin {
    // ... 
    function ckeditor_plugin($plugins) {
        return $plugins;

    function ckeditor_buttons($buttons) {
        return $buttons;
    // ...

Click here to download a sample plugin for WordPress that adds a button to CKEditor.

Posted at February 23rd, 2010.

Comments are closed.