Skip to main content

Performance

Stop the forms-plugin stylesheet bloat

Most forms plugins force-load 30-100 KB of CSS on every page, whether the page has a form or not. Here's the audit, and the fix.

Most WordPress forms plugins enqueue their stylesheet on every page of your site, regardless of whether the page has a form on it. Open any page on a typical install, view source, and you’ll find a forms-plugin-style.css link tag in the head.

Often three of them. The form’s base styles, the plugin’s “modern” theme, and a “dropdown” CSS file the plugin uses for one specific field type you never use.

Total weight: 30 to 100 KB of CSS. Loaded on every blog post, every product page, every contact-less landing page. To style a form that isn’t there.

How this happens

WordPress plugins use wp_enqueue_style() inside an init hook. The hook fires on every page load. Most plugin authors don’t bother to check whether the page actually contains the form before enqueuing. The form might appear via a shortcode, a block, a widget, a template-include, or a do_shortcode() call from another plugin. Detecting that reliably is genuinely hard.

So they don’t. The stylesheet ships everywhere.

What this costs you

Page weight on every page. Even compressed, a 60 KB CSS file is real bytes. Lighthouse will dock you on it for any page that doesn’t render the form.

Render-blocking CSS. Stylesheets in the head block the first paint. Even an unused stylesheet costs you on Largest Contentful Paint.

Caching plugin gymnastics. WP Rocket, Perfmatters, Autoptimize, all of them have to detect “is this CSS used here?” before they can defer it. They mostly fail. So the CSS loads, render-blocking, every page.

For a marketing site with traffic, this is real money in CDN bandwidth, and real seconds shaved off conversion.

What Core Forms does instead

Two specific decisions:

1. The CSS only enqueues when the form is rendered. Core Forms checks at render time, not at init time. If the page has no [cf_form] shortcode, no core-forms/form block, no template-include, the stylesheet never lands. The check happens inside Form::get_html(), so the enqueue is genuinely conditional.

2. There’s a global setting to disable the stylesheet entirely. If you have your own form CSS, or your theme already styles inputs, flip the toggle off and Core Forms doesn’t enqueue anything. You ship the form, the markup is unstyled, your theme handles the rest.

The toggle is in Settings → Default form theme. The default is on. The “off” path has been a clean exit since v4.0.0.

What if my plugin doesn’t do this?

If you can’t switch plugins (maybe you’ve got 200 forms across a multisite and the migration is real work), here’s a workaround.

In your theme’s functions.php:

add_action( 'wp_enqueue_scripts', function () {
    if ( has_block( 'your-forms-plugin/form' ) ) return;
    if ( has_shortcode( get_post()->post_content ?? '', 'your-shortcode' ) ) return;
    wp_dequeue_style( 'your-plugin-style-handle' );
}, 100 );

Replace the handle and the block/shortcode names. The hook priority of 100 runs after the plugin’s own enqueue, so the dequeue actually wins.

This is a band-aid. The right fix is a plugin that doesn’t ship CSS to pages without forms.

The thirty-second audit

On any WordPress site:

1. Open a page with no form on it (the homepage usually qualifies).
2. View source.
3. Search the head for "form" or "wpforms" or your forms plugin name.

If a forms-plugin stylesheet is in the head, you’ve got the bug.

For a sanity check, also run a Lighthouse pass on that page and look at the “Reduce unused CSS” diagnostic. The forms plugin will be the top offender on most installs.

The next step

Audit one site. Find one stylesheet that doesn’t belong. Either disable it or switch to a plugin that doesn’t force-load.

The Gutenberg block in Core Forms got the same treatment in v4.0.0. The block used to declare its stylesheet via block.json, which auto-enqueues whenever the block appears. We removed that and routed the enqueue through Form::get_html() instead, so the block now respects the same setting as the shortcode.

A plugin that ships fewer stylesheets is a plugin that wins on real Core Web Vitals, not just demo sites. That’s the bet here.

Build the form. Stop reading.

Every note here came out of a real Core Forms setup. Use CFLAUNCH for 20% off either plan.