How to stop my themes CSS changing the WordPress interface/?

This can happen if the function for enqueueing stylesheets, wp_enqueue_style() is run inside functions.php outside of a hooked function, like this:

<?php

wp_enqueue_style( 'my-style', get_stylesheet_uri() );

functions.php is loaded on the front-end and back-end when your theme is active, so this will load the stylesheet in both places.

To only load a stylesheet on the front-end you need to run this function inside another function that is hooked to the wp_enqueue_scripts hook:

<?php

function wpse_341512_enqueue_styles() {
    wp_enqueue_style( 'my-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'wpse_341512_enqueue_styles' );

By doing this, wp_enqueue_style() is only run when wpse_341512_enqueue_styles() is run, and using add_action() like this queues up that function to only run on the front-end.

tech