Skip to main content
2 of 2
added 8 characters in body
Chip Bennett
  • 55.1k
  • 8
  • 90
  • 170

WordPress provides a mce_css filter, that can be used to add custom stylesheets to the Visual Editor. According to the Codex:

The file can be a .php file, allowing dynamic generation of CSS rules for the content editor.

Example Codex filter callback, modified for a Theme:

function wpse120831_mce_css( $mce_css ) {
    if ( ! empty( $mce_css ) )
        $mce_css .= ',';

    $mce_css .= get_template_directory_uri() . '/dynamic-css.php';

    return $mce_css;
}

add_filter( 'mce_css', 'wpse120831_mce_css' );
Chip Bennett
  • 55.1k
  • 8
  • 90
  • 170