Git Product home page Git Product logo

makeitworkpress / wp-optimize Goto Github PK

View Code? Open in Web Editor NEW
51.0 7.0 9.0 71 KB

The WP Optimize class provides a wrapper to optimize WordPress and remove unnecessary or unwanted functions and scripts.

Home Page: https://makeitwork.press/scripts/wp-optimize/

License: GNU General Public License v3.0

PHP 100.00%
wordpress wordpress-library wordpress-development wordpress-optimization wordpress-php-library

wp-optimize's Introduction

wp-optimize

The WP Optimize class provides a wrapper to optimize WordPress and remove unnecessary or unwanted functions and scripts.

WP Optimize is maintained by Make it WorkPress.

Usage

Include the WP Optimize class in your plugin, theme or child theme file by requiring or autoloading the given file. You can read more about autoloading in the readme of wp-autoload.

Choose your optimisations

Determine which optimizations to run by setting an array of optimisations. A true value will execute the given optimisation.

Currently, the class defaults to the following optimisations:

$optimisations = [
    'block_external_HTTP'       => false, // Block requests to external http. Thus, blocks all request that are done by plugins to external addresses.
    'defer_CSS'                 => false, // Adds defer="defer" to all enqueued JavaScript files.
    'defer_JS'                  => true,  // Defers all registered scripts using the loadCSS function from the Filament Group.  
    'disable_comments'          => false, // Disables the comments functionality and removes it from the admin menu.
    'disable_block_styling'    => false, // Removes default Gutenberg block styling
    'disable_embed'             => false, // Removes the script files that are enqueued by the WordPress media embed system.
    'disable_emoji'             => true,  // Removes the scripts that are enqueued for displaying emojis.
    'disable_feeds'             => false, // Removes the post feeds.
    'disable_heartbeat'         => false, // Unregisters the heartbeat scripts, which is usually responsible for autosaves.
    'disable_jquery'            => false, // Removes the default jQuery script.
    'disable_jquery_migrate'    => true,  // Removes the jQuery Migrate script.
    'disable_rest_api'          => false, // Disables the rest api.
    'disable_RSD'               => true,  // Removes the RDS link in the head section of the site.
    'disable_shortlinks'        => true,  // Removes the shortlinks in the head section of the site. 
    'disable_theme_editor'      => false, // Disables the file editor for themes and plugins                    
    'disable_version_numbers'   => true,  // Removes the version trail in enqueued scripts and styles.           
    'disable_WLW_manifest'      => true,  // Removes the WLW Manifest links in the head section of the site.
    'disable_WP_version'        => true,  // Removes the WP version from the head section of the site.           
    'disable_XMLRPC'            => true,  // Disables the xmlrpc functionality.
    'jquery_to_footer'          => true,  // Moves the default jQuery script to the footer.
    'limit_comments_JS'         => true,  // Limits the JS for comments only to singular entities
    'limit_revisions'           => true,  // Limits the number of revisions to 5
    'remove_comments_style'     => true,  // Removes the .recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;} styling
    'slow_heartbeat'            => true   // Slows the heartbeat down to one per minute
];

Create instance

Create a new instance of the WP_Optimize class with your optimisations array as arguments.

$optimize = new MakeitWorkPress\WP_Optimize\Optimize($optimisations);

wp-optimize's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.