1

I'm attempting to add a visual editor style with the function add_editor_style('visual-editor.css');, but only on the widgets admin' page, and not on post editor screens. I'm using a visual editor widget by Black Studio.

I've not been able to separate the two; the custom styling appears on both the visual editor widget and the post editor screen. Why would this be?

Here's the code I'm using:

add_action( 'admin_init', 'on_widget_page' );
function on_widget_page(){
    $screen = get_current_screen();
    if ( $screen->id = 'widgets' ) {
        add_editor_style('visual-editor.css');
    }
}

Thanks very much for your time.

  • 1
    you have a php error, you use "=" instead of "==" – Mark Kaplun Feb 19 '16 at 8:36
  • Using $screen->id == 'widgets' seems to disable the visual editor style altogether, for me. – Tim Feb 19 '16 at 9:01
  • maybe it does, but you are not going to get anywhere with broken php..... have you check what is the screen id on those pages? – Mark Kaplun Feb 19 '16 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.