• I was wondering if anyone knows of a way to disable all CSS across an entire self-hosted WordPress site? I don’t mean for a specific plugin or theme, I do mean across the whole site.

    When I show a client a website (remotely or in person), they look at the content and mostly ignore how it fits together until something doesn’t work, so I’m interested in this as a means of illustrating the value of design vs content so that they look at the design.

    Thank you.

    Ian

Viewing 3 replies - 1 through 3 (of 3 total)
  • It depends on whether you want to affect all users or just one.
    For all, you can use one of the hooks to remove the stylesheets so they are not output: https://developer.www.ads-software.com/?s=style&post_type%5B%5D=wp-parser-hook
    This could be done on a user basis also.
    Another option is to inject a script that removes the stylesheets.
    Or you could use a bookmarklet that removes the stylesheets, requiring user interaction to trigger it.
    Or you could use a browser extension that controls the loading of resources, blocking CSS files from that server.

    Thread Starter Ian

    (@ianonmac)

    Joy, thank you for the reply. I’m not looking to affect users, I’m looking to temporarily affect all visitors to the site whilst it’s being developed.

    Also, I’m not familiar with hooks or how to use them. I was hoping there was one small change I could make such as a file rename or one line of code, but it appears not.

    It could be very simple with a hook.
    I tested this locally by putting it in my child theme functions.php file, and it seems to work.

    function remove_styles($to_do) {
    	return array();
    }
    if (! is_admin()) add_filter( 'print_styles_array', 'remove_styles', 10, 1 );
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to disable all CSS sitewide?’ is closed to new replies.