I'm using the plugin 'Ninja From' and I'm trying to stop it from loading a CSS file in the header.

The CSS file:

<link rel='stylesheet' id='nf-display-css'  href='http://example.com/wp-content/plugins/ninja-forms/assets/css/display-structure.css?ver=4.7.1' type='text/css' media='all' />

My code:

function remove_css_ninja_form(){

add_action( 'wp_enqueue_scripts', 'remove_css_ninja_form', 99999 );
add_action( 'wp_print_styles', 'remove_css_ninja_form', 99999 );
add_action( 'wp_head', 'remove_css_ninja_form', 9999 );

It is not working.

  • sorry for the typo.
    – Rex
    Jan 15, 2017 at 20:43

3 Answers 3


Extract the ninja form plugin's files to a folder, and use a text editor such as Notepad++ to search within the files of the plugin and find either one of these phrases:

`wp_enqueue_style` OR `css_ninja_form`

You will end up with at least 1 result, which will be similar to :

add_action( 'wp_enqueue_scripts', 'css_ninja_form', xyz );

Which xyz is the priority the author of the plugin used to enqueue it. Now, you can directly remove the line from the result page (not recommended) or you can use the xyz priority to dequeue the script in your function.php.


You need to dequeue the style in nf_display_enqueue_scripts like this :

add_action('nf_display_enqueue_scripts', function () {

In WordPress priority $arg, Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.

So in your functions file, I'd suggest you use:

add_action( 'wp_head', 'remove_css_ninja_form', 0 );
  • you will want to use lower priority to make sure the script was enqueued. If your priority is too high, you will try to remove the script before it was enqueued, which will obviously do nothing Jan 15, 2017 at 21:11
  • what priority would you recommend?
    – Rex
    Jan 15, 2017 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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