current_user_can() ) { return; } /* Register the TinyMCE plugin */ add_filter( 'mce_external_plugins', function ( $plugins ) { $plugins['code_snippets'] = plugins_url( 'dist/mce.js', PLUGIN_FILE ); return $plugins; } ); /* Add the button to the editor toolbar */ add_filter( 'mce_buttons', function ( $buttons ) { $buttons[] = 'code_snippets'; return $buttons; } ); /* Add the translation strings to the TinyMCE editor */ add_filter( 'mce_external_languages', function ( $languages ) { $languages['code_snippets'] = __DIR__ . '/mce-strings.php'; return $languages; } ); } }