Skip to content

Instantly share code, notes, and snippets.

@acf-extended
Created July 15, 2020 23:42
Show Gist options
  • Save acf-extended/e4404d7ca0412ae162a960469e70abf0 to your computer and use it in GitHub Desktop.
Save acf-extended/e4404d7ca0412ae162a960469e70abf0 to your computer and use it in GitHub Desktop.
<?php
/*
* TinyMCE: Add Tailwind CSS style
*/
add_editor_style('/assets/css/tailwind.min.css');
/*
* TinyMCE: Remove WP styles
*/
add_filter('mce_css', 'my_tinymce_remove_stylesheets');
function my_tinymce_remove_stylesheets($stylesheets){
$stylesheets = explode(',', $stylesheets);
foreach($stylesheets as $key => $sheet){
if(!preg_match('/wp\-includes/', $sheet))
continue;
unset($stylesheets[$key]);
}
$stylesheets = implode(',', $stylesheets);
return $stylesheets;
}
/*
* TinyMCE: Remove the hardcoded 'lightgray' skin style
*/
add_filter('tiny_mce_before_init', 'my_tinymce_remove_hardcoded_skin');
function my_tinymce_remove_hardcoded_skin($init){
$init['init_instance_callback'] = ''
. 'function(){'
. ' jQuery("#content_ifr").contents().find("link[href*=\'content.min.css\']").remove();'
. '}';
return $init;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment