Support

Account

Home Forums Front-end Issues Disabling admin css for front end form

Solving

Disabling admin css for front end form

  • Hi,

    I’ve managed to create it front end form for my custom fields following the instructions from this article.

    However, the last bit about disabling the admin CSS doesn’t seem to work – the form still look the way they do in the back end and thus conflict with my site’s style. I’m suspecting that the CSS is actually from the ACF’s CSS but I don’t know how bypass this using wp_deregister_style(). Any ideas?

  • Did you tried this in your functions.php

    
    add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
     
    function my_deregister_styles() {
    	wp_deregister_style( 'wp-admin' );
    }
  • Yep – that’s what I’ve tried, doesn’t seem to work. Like I said, I’m suspecting the CSS is actually coming from ACF’s CSS files instead of the WP admin CSS files, but I’m not sure how to disable these.

  • Bumping as I’d like to know if there’s an answer for this.

  • This worked for me:

    // disable acf css on front-end acf forms
    add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
     
    function my_deregister_styles() {
      wp_deregister_style( 'acf' );
      wp_deregister_style( 'acf-field-group' );
      wp_deregister_style( 'acf-global' );
      wp_deregister_style( 'acf-input' );
      wp_deregister_style( 'acf-datepicker' );
    }
Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Disabling admin css for front end form’ is closed to new replies.