How do I get rid of unused CSS and Javascript without plugin in WordPress?

How do I remove unused JavaScript and CSS in WordPress?

How to remove unused CSS

  1. Install Asset CleanUp. Go to plugin then Add new. …
  2. Go to plugin settings. To access plugin settings, from WordPress dasboard click on settings then click on Asset CleanUp.
  3. Unload unwanted CSS and JS.

How do I get rid of unused CSS in WordPress without plugins?

How to use the purified CSS code on your WordPress website

  1. Upload purified stylesheet. …
  2. Remove existing stylesheets. …
  3. Make sure all styles have been removed. …
  4. Remove inline styles if any exists. …
  5. Enqueue the purified CSS. …
  6. Test your changes thoroughly! …
  7. Adjust purified CSS code.


How do I remove unused CSS and JavaScript from my website?

How to remove unused CSS manually

  1. Open Chrome DevTools.
  2. Open the command menu with: cmd + shift + p.
  3. Type in “Coverage” and click on the “Show Coverage” option.
  4. Select a CSS file from the Coverage tab which will open the file up in the Sources tab.
IT IS INTERESTING:  What is the cheapest web hosting for WordPress?


How do I remove JavaScript from WordPress?

Remove unused CSS JS files in WordPress. Remove scripts that won’t work with wp_dequeue_script. The entire plugin.

Remove unused CSS JS files in WordPress

  1. wp_deregister_script($handle)
  2. wp_dequeue_script($handle)
  3. wp_deregister_style($handle)
  4. wp_dequeue_style($handle)


How do I get rid of unused CSS in WordPress?

On the post edit screen, you’ll find the Asset CleanUp box just below the post editor. The plugin will automatically fetch and list all the files and assets loaded when a visitor views this page on your website. You can then simply unload the unused CSS or JavaScript files that you don’t need on that page.

How do I manually remove unused JavaScript from WordPress?

3. Remove unused JavaScript

  1. Step 1: Install Asset CleanUp Or Perfmatters. …
  2. Step 2: Enable Test Mode If Using Asset CleanUp.
  3. Step 3: Enable The Script Manager If Using Perfmatters.
  4. Step 4: Disable JavaScript Files Where They Don’t Need To Load.


How do I get rid of unused CSS per page?

Use Asset CleanUp to Remove Unused CSS files

Asset CleanUp helps you unload files from plugins and themes per page (or type of page). For example, I’ve unloaded Contact Form 7’s files from the home page. Similarly, remove the files one by one that you think is not required. Make sure to test the site after doing this.

How do you purge CSS?

Basically, you run it against your CSS files and your HTML/JavaScript files. It will parse and analyze which CSS content will be used and remove unused CSS content. PurgeCSS can be used as a CLI.

IT IS INTERESTING:  How long does it take to set up WooCommerce?

How do I remove unused CSS Autoptimize?

Install Autoptimize then enable the settings to optimize/aggregate CSS and JavaScript files. Next, install Async JavaScript and click “apply defer” in the settings. If you retest your site, you may see improved scores not only for removing unused CSS, but render-blocking issues as well.

How do I know if I have unused CSS?

How to detect unused CSS # The Coverage tab of Chrome DevTools can help you discover critical and uncritical CSS. See View used and unused CSS with the Coverage tab. Chrome DevTools: Coverage tab.

How do I remove unused JavaScript code from my website?

How to remove unused JavaScript

  1. Detect unused JavaScript. The Coverage tab in Chrome DevTools can give you a line-by-line breakdown of unused code. …
  2. Build tool for support for removing unused code. Check out the following Tooling. …
  3. Angular. …
  4. Drupal. …
  5. Joomla. …
  6. Magento. …
  7. React. …
  8. WordPress.


How do I get unused CSS online?

The Coverage tab in Chrome DevTools can help you find unused JavaScript and CSS code. Removing unused code can speed up your page load and save your mobile users cellular data.

Can I delete JavaScript files?

All Javascript files on your computer will appear in the search window. Analyze the list of Javascript files, and decide which files you wish to delete. Holding “Shift” on the keyboard, click on each file you wish to delete. Press “Del” on the keyboard, and click “Yes” to confirm the file deletion.

What is unused JavaScript?

Overview. Reducing unused JavaScript can reduce render-blocking behaviour to speed up your page load and improve your visitors’ page experience. By default, JavaScript files are render-blocking because they block the browser from dealing with other page load tasks, thus delaying your page’s First Paint.

IT IS INTERESTING:  How do I integrate a WordPress site?

How do I dequeue styles in WordPress?

Dequeue Styles and Scripts In WordPress

  1. You can add the stylesheet link tag directly on the page using the wp_head action.
  2. You can add the stylesheet link tag directly to the page anywhere.
  3. You can use the wp_enqueue_scripts action to add a handle to the wp_enqueue_style.


Best WordPress Themes