我的网站WordPress后端未加载CSS…。前端工作正常,但一旦我尝试登录到我的wordpress管理员,页面加载将不带任何样式。。我多次重新安装WordPress核心文件,并尝试添加这些文件(define(\'CONCATENATE\\u SCRIPTS\',false);define(\'SCRIPT\\u DEBUG\',true);在wp配置中。php但问题仍未修复
chrome Consor中的错误显示:
拒绝应用来自“”的样式https://www.csm.school/wp-admin/load-styles.php?c=1&;dir=长期(&R);加载%5Bchunk\\u 0%5D=仪表盘图标、管理栏、wp指针、站点运行状况、公用、表单、管理菜单、仪表盘、列表表、编辑、修订、媒体、主题、关于、导航和维护;加载%5Bchunk\\u 1%5D=enus、widgets、站点图标、l10n、按钮、wp auth check&;ver=5.4.2”,因为其MIME类型(“文本/html”)不是受支持的样式表MIME类型,并且启用了严格的MIME检查。
作用php:
<?php
// simple error trapping on screen
// Report simple running errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// full errors
// error_reporting(E_ALL);
/**
* Customify functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package customify
*/
/**
* Same the hook `the_content`
*
* @TODO: do not effect content by plugins
*
* 8 WP_Embed:run_shortcode
* 8 WP_Embed:autoembed
* 10 wptexturize
* 10 wpautop
* 10 shortcode_unautop
* 10 prepend_attachment
* 10 wp_make_content_images_responsive
* 11 capital_P_dangit
* 11 do_shortcode
* 20 convert_smilies
*/
global $wp_embed;
add_filter( \'customify_the_content\', array( $wp_embed, \'run_shortcode\' ), 8 );
add_filter( \'customify_the_content\', array( $wp_embed, \'autoembed\' ), 8 );
add_filter( \'customify_the_content\', \'wptexturize\' );
add_filter( \'customify_the_content\', \'wpautop\' );
add_filter( \'customify_the_content\', \'shortcode_unautop\' );
add_filter( \'customify_the_content\', \'wp_make_content_images_responsive\' );
add_filter( \'customify_the_content\', \'capital_P_dangit\' );
add_filter( \'customify_the_content\', \'do_shortcode\' );
add_filter( \'customify_the_content\', \'convert_smilies\' );
/**
* Same the hook `the_content` but not auto P
*
* @TODO: do not effect content by plugins
*
* 8 WP_Embed:run_shortcode
* 8 WP_Embed:autoembed
* 10 wptexturize
* 10 shortcode_unautop
* 10 prepend_attachment
* 10 wp_make_content_images_responsive
* 11 capital_P_dangit
* 11 do_shortcode
* 20 convert_smilies
*/
add_filter( \'customify_the_title\', array( $wp_embed, \'run_shortcode\' ), 8 );
add_filter( \'customify_the_title\', array( $wp_embed, \'autoembed\' ), 8 );
add_filter( \'customify_the_title\', \'wptexturize\' );
add_filter( \'customify_the_title\', \'shortcode_unautop\' );
add_filter( \'customify_the_title\', \'wp_make_content_images_responsive\' );
add_filter( \'customify_the_title\', \'capital_P_dangit\' );
add_filter( \'customify_the_title\', \'do_shortcode\' );
add_filter( \'customify_the_title\', \'convert_smilies\' );
// Include the main Customify class.
require_once get_template_directory() . \'/inc/class-customify.php\';
/**
* Main instance of Customify.
*
* Returns the main instance of Customify.
*
* @return Customify
*/
function Customify() {
// phpc:ignore WordPress.NamingConventions.ValidFunctionName.
return Customify::get_instance();
}
Customify();
加载样式。php:
<?php
/**
* Disable error reporting
*
* Set this to error_reporting( -1 ) for debugging
*/
error_reporting( 0 );
/** Set ABSPATH for execution */
if ( ! defined( \'ABSPATH\' ) ) {
define( \'ABSPATH\', dirname( __DIR__ ) . \'/\' );
}
define( \'WPINC\', \'wp-includes\' );
require ABSPATH . \'wp-admin/includes/noop.php\';
require ABSPATH . WPINC . \'/script-loader.php\';
require ABSPATH . WPINC . \'/version.php\';
$protocol = $_SERVER[\'SERVER_PROTOCOL\'];
if ( ! in_array( $protocol, array( \'HTTP/1.1\', \'HTTP/2\', \'HTTP/2.0\' ) ) ) {
$protocol = \'HTTP/1.0\';
}
$load = $_GET[\'load\'];
if ( is_array( $load ) ) {
ksort( $load );
$load = implode( \'\', $load );
}
$load = preg_replace( \'/[^a-z0-9,_-]+/i\', \'\', $load );
$load = array_unique( explode( \',\', $load ) );
if ( empty( $load ) ) {
header( "$protocol 400 Bad Request" );
exit;
}
$rtl = ( isset( $_GET[\'dir\'] ) && \'rtl\' == $_GET[\'dir\'] );
$expires_offset = 31536000; // 1 year.
$out = \'\';
$wp_styles = new WP_Styles();
wp_default_styles( $wp_styles );
if ( isset( $_SERVER[\'HTTP_IF_NONE_MATCH\'] ) && stripslashes( $_SERVER[\'HTTP_IF_NONE_MATCH\'] ) === $wp_version ) {
header( "$protocol 304 Not Modified" );
exit();
}
foreach ( $load as $handle ) {
if ( ! array_key_exists( $handle, $wp_styles->registered ) ) {
continue;
}
$style = $wp_styles->registered[ $handle ];
if ( empty( $style->src ) ) {
continue;
}
$path = ABSPATH . $style->src;
if ( $rtl && ! empty( $style->extra[\'rtl\'] ) ) {
// All default styles have fully independent RTL files.
$path = str_replace( \'.min.css\', \'-rtl.min.css\', $path );
}
$content = get_file( $path ) . "\\n";
if ( strpos( $style->src, \'/\' . WPINC . \'/css/\' ) === 0 ) {
$content = str_replace( \'../images/\', \'../\' . WPINC . \'/images/\', $content );
$content = str_replace( \'../js/tinymce/\', \'../\' . WPINC . \'/js/tinymce/\', $content );
$content = str_replace( \'../fonts/\', \'../\' . WPINC . \'/fonts/\', $content );
$out .= $content;
} else {
$out .= str_replace( \'../images/\', \'images/\', $content );
}
}
header( "Etag: $wp_version" );
header( \'Expires: \' . gmdate( \'D, d M Y H:i:s\', time() + $expires_offset ) . \' GMT\' );
header( "Cache-Control: public, max-age=$expires_offset" );
echo $out;
exit;
。Htaccess:
<FilesMatch index.php>
Order Allow,Deny
Allow from all
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</IfModule>