Page Optimizers

Pro Feature

Many page optimizer plugins offer a Remove Unused CSS (also called Used CSS) feature. It loads a page, keeps only the CSS selectors it sees in the HTML at that moment, and deletes the rest. Football Leagues adds a lot of its classes with JavaScript after the page loads – live score updates, sliders, sortable stat tables, tooltips, tabs, and modal windows. The optimizer can’t see those classes when it scans, so it strips their CSS and the Football Leagues UI loses its styling.

Who this affects

Only sites running a page optimizer with a “Remove Unused CSS” / “Used CSS” option turned on. If you don’t use one, this page doesn’t apply – there’s nothing to do.

🎯 What you need to do

Football Leagues handles the common optimizers for you. Three are fully automatic; one needs a single manual step because it only exposes the setting in its own interface.

OptimizerRemoves unused CSS?What you need to do
PerfmattersYesNothing – automatic
WP RocketYesNothing – automatic
LiteSpeed CacheYes (UCSS)Nothing – automatic
FlyingPressYesOne manual step (below)

The automatic protection is on by default and needs no setup. It also covers the free Football Leagues styles, so a premium site is fully protected. Each rule is inert when its optimizer isn’t installed, so it never interferes with anything else.

Manual step for FlyingPress

FlyingPress doesn’t offer a way for a plugin to register an exclusion, so you add it once yourself. Paste this value into its stylesheet-exclude field:

football-leagues-by-anwppro

That single value matches every Football Leagues stylesheet – core and premium – so you only need to add it once.

  1. Open Settings > FlyingPress and find the CSS section.
  2. Confirm Remove Unused CSS is on. If it’s off, none of this applies.
  3. In the Exclude Stylesheets box, add football-leagues-by-anwppro.
  4. Save and purge the cache so the CSS is rebuilt.

Football Leagues reminds you

When Football Leagues detects FlyingPress, it shows a dismissible notice on its own admin pages with the exact value to paste. Dismiss it once you’ve added the exclusion. If you added the same value to LiteSpeed Cache by hand in the past, you can leave it – the automatic rule and a manual entry don’t conflict.

Purge the generated CSS afterward

Purge the optimizer’s generated “Used CSS” / “UCSS” once so it rebuilds – after you add the exclusion by hand, and also right after updating Football Leagues on a site where the automatic protection is new. Otherwise the old, already-stripped version stays cached and Football Leagues still looks broken.

Turning it off or extending it (developers)

The automatic protection is safe to leave on – it only tells optimizers to skip Football Leagues CSS. If you need to change it, use the constant or filters below.

Disable it entirely

// In wp-config.php:
define( 'ANWPFL_DISABLE_OPTIMIZER_COMPAT', true );

// Or from a theme / plugin:
add_filter( 'anwpfl/optimizer_compat/enabled', '__return_false' );

Filters

FilterPurpose
anwpfl/optimizer_compat/enabledReturn false to turn the whole feature off.
anwpfl/optimizer_compat/path_fragmentsAdd extra CSS path fragments to exclude – useful for an add-on that ships its own Football Leagues stylesheets.
anwpfl/optimizer_compat/manual_optimizersAdd another UI-only optimizer to the admin notice, as slug => [ 'name' => ..., 'field' => ... ].

For example, to also protect an add-on’s stylesheets:

add_filter( 'anwpfl/optimizer_compat/path_fragments', function ( $fragments ) {
    $fragments[] = 'my-fl-addon';
    return $fragments;
} );

πŸ“š Related