skip to Main Content

A Plugin i use in WordPress has a css stylesheet which I only need in the frontend but not in the wordpress backend. (There it causes a small bug)

How can I prevent the stylesheet from loading in the backend?
Or the other way around, how can I make a stylsheet load only in the frontend?

Thanks for your help!

2

Answers


  1. With Simple Custom CSS and JS plugin by SilkyPress.com the CSS can be set to appear In Frontend, In Admin or On Login Page separately.

    Login or Signup to reply.
  2. Check slug of imported style and use this solution

    // this will remove the stylesheet when init fires
    add_action('admin_init','your_remove_default_stylesheets');
    
    // this is your function to deregister the default admin stylesheet
    function your_remove_default_stylesheets() {
        wp_deregister_style('wp-admin');
    }
    

    Change wp-admin to your slug
    https://developer.wordpress.org/reference/functions/wp_deregister_style/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search