i use woocommerce and woocommerce Product Vendors (https://woocommerce.com/products/product-vendors/) i want hide elements of admin with css file "my-admin.css" I put css file "my-admin.css" at the root of my child theme wordpress and use this code in functions.php. This does not work?!?

function admin_css() {
    $admin_handle = 'admin_css';
    $admin_stylesheet = get_template_directory_uri() . 'my-admin.css';

    wp_enqueue_style($admin_handle, $admin_stylesheet);
add_action('admin_print_styles', 'admin_css', 11);

is this an obselete method? because: when i use this other method in functions.php, it's ok it works add_action('admin_head', 'my_custom_fonts');

function my_custom_fonts() {
  echo '<style>
    body, td, textarea, input, select {
      font-family: "Lucida Grande";
      font-size: 12px;

What do you think ? thanks !!! :)

  • here is my corrected code is it better? because still does not work? here is what my functions.php file contains there may be an error? thank you ! :) <?php /* activation theme */ function wpm_enqueue_styles(){ wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); } add_action( 'wp_enqueue_scripts', 'wpm_enqueue_styles' ); function wp245372_admin_enqueue_scripts() { wp_enqueue_style( 'my-admin-css', get_template_directory_uri() . '/my-admin.css' ); } add_action( 'admin_enqueue_scripts', 'wp245372_admin_enqueue_scripts' );
    – Calachuka
    Oct 11, 2021 at 19:37
  • I converted your answer into a comment, this isn't a discussion forum and you had not posted a reply, you had posted the solution to your question. People might avoid your question thinking you had found the answer already. If you have updates use the Edit link underneath the tags to modify your question to add more information or updates
    – Tom J Nowell
    Oct 12, 2021 at 9:46

1 Answer 1


It's always better to encapsulate your styles in a separate file, so your first example is closer. That said, the documentation for admin_print_styles says quite clearly:

admin_print_styles should not be used to enqueue styles or scripts on the admin pages. Use admin_enqueue_scripts instead.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.