WooCommerce后台自定义面板样式修改:查询对应CSS文件
Hey there, let's clear this up first — that load-style.php file you're seeing isn't a physical CSS file you can edit directly. It's WordPress's dynamic handler that combines and minifies all the admin CSS files on the fly, so any changes there would be overwritten instantly or break things.
Here's the proper way to modify those WooCommerce admin styles without messing with core files:
1. Use a Custom Admin CSS File (Recommended Method)
If you're using a child theme (and you should be, to avoid losing changes on theme updates), follow these steps:
- Create a new file in your child theme directory named
admin-custom.css - Add your modified CSS to this file:
.categorydiv div.tabs-panel, .customlinkdiv div.tabs-panel, .posttypediv div.tabs-panel, .taxonomydiv div.tabs-panel, .wp-tab-panel { min-height: 60px; /* Adjust this to your desired value */ max-height: 500px; overflow: auto; padding: 0 .9em; border: 1px solid #ccc; background-color: #f8f8f8; } - Next, add this snippet to your child theme's
functions.phpfile to load the custom CSS only on WooCommerce admin pages (so you don't affect other parts of the WordPress admin):add_action('admin_enqueue_scripts', 'custom_woocommerce_admin_styles'); function custom_woocommerce_admin_styles() { $current_screen = get_current_screen(); // Only load the CSS on WooCommerce-related admin screens if (str_contains($current_screen->id, 'woocommerce')) { wp_enqueue_style( 'custom-woocommerce-admin-css', get_stylesheet_directory_uri() . '/admin-custom.css', array(), // Dependencies (leave empty unless you need to load after specific styles) wp_get_theme()->get('Version') ); } }
2. Use a Plugin (No-Code Option)
If you don't want to mess with theme files, grab a plugin like Admin Custom CSS (or similar admin styling plugins). Once activated, you can paste your modified CSS directly into the plugin's settings page — it'll handle loading the styles in the admin for you.
Important Notes
- Never edit core WooCommerce or WordPress CSS files: Any changes you make there will be wiped out the next time you update the plugin or WordPress itself.
- Targeting specific screens: The snippet above limits the CSS to WooCommerce pages, which is a good practice to avoid unintended style changes elsewhere in the admin.
内容的提问来源于stack exchange,提问作者Sevun

