0

I renamed style.css to my-style.css, but now I am getting an error in WordPress:

"The requested theme does not exist. Stylesheet is missing."

I know the reason for that error, but how can I solve that without changing the stylesheet name again?

1

Your theme must contain a style.css file, and it needs to have a comment at the top with the theme details.

https://developer.wordpress.org/themes/basics/main-stylesheet-style-css/

4
  • just i have changed name, sir. comments are at the top
    – user208353
    Jul 9 '21 at 7:07
  • 'Your theme must contain a style.css file'.. that't what i want to change
    – user208353
    Jul 9 '21 at 7:08
  • how to be get worked with changed name css file
    – user208353
    Jul 9 '21 at 7:08
  • 1
    You can't. Themes must have a style.css file. There's nothing stopping you putting your actual CSS in a separate file and enqueuing that. But you still need style.css. There is no fllter to change this. Jul 9 '21 at 7:28
0

You can not delete style.css and have a functioning theme (at least without hacking WordPress core files). All the theme meta information is written in the style specifically. You can, however register another css file named my-style.css or whatever the name you want.

function my_theme_css() {
    wp_enqueue_style( 'my-style', get_template_directory() . '/my-style.css' );
}
add_action( 'wp_enqueue_scripts', 'my_theme_css' );

Now, your style.css does not have any css so you may want to remove it from your html. You can remove it from your site's <head> using wp_dequeue_style(). But the physical file has to be there in your theme's directory.

add_action('init','_remove_style');

function _remove_style(){

    wp_dequeue_style('style.css'); 
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy