Download the PHP package renzojohnson/cf7-asset-optimizer without Composer

On this page you can find all versions of the php package renzojohnson/cf7-asset-optimizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cf7-asset-optimizer

CF7 Asset Optimizer

Latest Version PHP Version License

Only loads Contact Form 7 scripts and styles on pages that actually contain a form. Zero configuration.

Fixes Contact Form 7 #1278 — CF7 enqueues its JS, CSS, reCAPTCHA, Turnstile, and Stripe scripts on every single page, even pages with no form. This plugin detects whether the current page has a CF7 form and dequeues all CF7 assets when no form is present.

Author: Renzo Johnson

Requirements

Installation

Via Composer

Manual

Download and upload to /wp-content/plugins/cf7-asset-optimizer/, then activate.

As mu-plugin

Copy cf7-asset-optimizer.php to /wp-content/mu-plugins/.

How It Works

The plugin hooks into CF7's own wpcf7_load_js and wpcf7_load_css filters to conditionally disable asset loading. On pages without a form, it also dequeues module scripts (reCAPTCHA, Turnstile, Stripe, SWV).

Detection

The plugin checks for CF7 forms in:

Assets Dequeued

When no form is detected, these handles are dequeued:

Handle Source
contact-form-7 Main CF7 JS
contact-form-7-html5-fallback Datepicker fallback
swv Schema-based Validation
wpcf7-recaptcha reCAPTCHA v3 handler
google-recaptcha Google reCAPTCHA API
cloudflare-turnstile Cloudflare Turnstile API
wpcf7-stripe Stripe JS
contact-form-7 (style) Main CF7 CSS
contact-form-7-rtl (style) RTL CSS
jquery-ui-smoothness (style) jQuery UI theme
wpcf7-stripe (style) Stripe CSS

Edge Cases

For forms rendered via PHP templates or dynamic shortcodes not in post content:

Testing

Related Project

If you use Contact Form 7 with Mailchimp, check out Chimpmatic — a CF7-to-Mailchimp integration plugin with 50,000+ active installations. Supports merge field mapping, subscriber tags, groups, double opt-in, and GDPR consent. Built by the same developer.

Links

License

MIT License. Copyright (c) 2026 Renzo Johnson.


All versions of cf7-asset-optimizer with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package renzojohnson/cf7-asset-optimizer contains the following files

Loading the files please wait ...