试图覆盖 WordPress 管理样式 (load-styles.php)

Trying to override WordPress admin styles (load-styles.php)

我完全按照@riddleMeThis recommended here 做了,但 WordPress 没有阅读样式。我错过了什么?

儿童主题functions.php

// Add styles for admin page - event edit table looks terrible after adding columns for custom taxo's
add_action('admin_head', 'admin_styles');

function admin_styles() {
    echo '<link rel="stylesheet" href="custom-editor-style.css" type="text/css" media="all" />';
}

custom-editor-style.css,位于子主题目录中(与 style.css 相同的目录)

table.fixed {
    table-layout: auto !important;
}

理论上这应该覆盖 load-styles.php 中的 table.fixed 声明,除非 php 文件在我的 add_action() 调用后加载...TIA

您没有正确定位样式 sheet,因为它的路径是错误的。

// Add styles for admin page - event edit table looks terrible after adding columns for custom taxo's
add_action('admin_head', 'admin_styles');

function admin_styles() {
    echo '<link rel="stylesheet" href="'. get_stylesheet_directory_uri() . '/custom-editor-style.css" type="text/css" media="all" />';
}