S
S
sqtr2021-06-15 19:26:13
WordPress
sqtr, 2021-06-15 19:26:13

How to make theme styles not touch wp-admin?

I have theme styles applied in wp-admin too

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri Gorbunov, 2021-06-15
@sqtr

In the function of connecting styles and scripts, wrap in a condition

if( ! is_admin() ) {
// здесь стили
}

P
pLavrenov, 2021-06-17
@pLavrenov

add_action('wp_print_styles', 'add_styles');
if (!function_exists('add_styles')) {
  function add_styles() {
      if(is_admin()) return false;
      wp_enqueue_style( 'main', get_template_directory_uri().'/styles/main.min.css', false, '0.0.1' );
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question