phpcsswordpressftpenqueue

How can i fix a Mimetype error when uploading a stylesheet to wordpress?


My CSS

/*
Theme Name: Data Kraken
Theme URI: https://wordpress.com/themes/d-k/
Description: With bold featured images and bright, cheerful colors, Dara is ready to get to work for your business.
Version: 1.0.0
Author: Automattic
Author URI: http://wordpress.com/themes/
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: d-k


*/

My functions.php

<?php 
    function enqueue_kraken_theme(){

        //style
        wp_enqueue_style( 
            "custom",
            get_template_directory(  ) . "/style.css",
            array(),
            "1.0.0",
            "all"
        );


    }

    add_action("wp_enqueue_scripts", "enqueue_kraken_theme");



Currently I am trying to enqueue the style sheet style.css but I keep getting the error message

Refused to apply style from 
because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

I'm unsure what is going on as I'm trying to just upload the style.css file.

How can i fix a Mimetype error when uploading a stylesheet to wordpress?


Solution

  • You are using get_template_directory(), which returns an absolute path to the directory. You should use get_template_directory_uri() i.e.

    wp_enqueue_style("custom", get_template_directory_uri() . "/style.css", array(), "1.0.0", "all");