• publicradio

    (@publicradio)


    I have seen lots of solutions for removing block editor CSS from the front end, but I’m trying to strip the styles from the editor as well.

    I have disabled a but a very few blocks for my site: Image, paragraph, list, quote, image. Basically the blocks that are available here in the WordPress Forums.

    I am trying to pull my main stylesheet into the editor as an editor stylesheet, so my front and back ends match. I don’t want to fight with the built-in block editor styles, either on the front or the back end. I just want them removed.

    How do I dequeue/deregister/disable block editor styles from the admin?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    wp_dequeue_style() would be the right function. Call it from within a “admin_enqueue_scripts” action callback. Add the callback with a large $priority arg to ensure styles are first enqueued prior to dequeuing them.

    You’ll need the correct enqueue handle for each stylesheet. I believe it’s the same as the HTML link’s ID attribute less the trailing “-css”. For example, to dequeue this link:
    <link rel='stylesheet' id='dashicons-css' href='https://example.com/wp-includes/css/dashicons.css?ver=6.4.1' media='all' />
    I think the correct handle would be “dashicons”

    All untested, but the correct approach is certainly something along these lines.

Viewing 1 replies (of 1 total)
  • The topic ‘Disable block editor css from the admin (not frontend)’ is closed to new replies.