wordpress style.css 不生效 缓存 cache问题

I had the same problem and I fixed it in another way than the default.


First I located the file that I need to change:


wp-includes\theme.php

There is a function called get_stylesheet_uri


My function looks like this:


function get_stylesheet_uri() {

    $time = time();

    $stylesheet_dir_uri = get_stylesheet_directory_uri();

    $stylesheet_uri = $stylesheet_dir_uri . '/style.css?v='.$time;

    /**

     * Filter the URI of the current theme stylesheet.

     *

     * @since 1.5.0

     *

     * @param string $stylesheet_uri     Stylesheet URI for the current theme/child theme.

     * @param string $stylesheet_dir_uri Stylesheet directory URI for the current theme/child theme.

     */

    return apply_filters( 'stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri );






标签: none

添加新评论 »