• Both solutions don’t work for some reason, they give me a 404 file not found while the path to the file is 300% correct.

    This is just copy/paste from the WordPress Codex and all I want to do is simply add some editor styles to my theme through a plugin.
    Yes I tried those functions one by one not both at the same time.

    function my_editor_styles() {
    
    	$editor_styles = plugins_url( '/assets/css/editor_styles.css', __FILE__ );
    
    	add_editor_style( $editor_styles );
    
    }
    add_action( 'after_setup_theme', 'my_editor_styles' );
    // add extra editor CSS styles
    function my_editor_styles( $mce_css ) {
    
    	if ( ! empty( $mce_css ) )
    
    		$mce_css .= ',';
    
    	$mce_css .= plugins_url( '/assets/css/editor_styles.css', __FILE__ );
    
    	return $mce_css;
    
    }
    add_filter( 'mce_css', 'my_editor_styles' );
Viewing 1 replies (of 1 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    $editor_styles = plugins_url( '/assets/css/editor_styles.css', __FILE__ );

    That means the code for your style is going to be found here: example.com/wp-content/plugins/yourplugin/assets/css/editor_styles.css

    Is that where you put it?

Viewing 1 replies (of 1 total)

The topic ‘Adding editor styles through plugin’ is closed to new replies.