Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/makeitworkpress/wp-optimize
The WP Optimize class provides a wrapper to optimize WordPress and remove unnecessary or unwanted functions and scripts.
https://github.com/makeitworkpress/wp-optimize
wordpress wordpress-development wordpress-library wordpress-optimization wordpress-php-library
Last synced: 3 months ago
JSON representation
The WP Optimize class provides a wrapper to optimize WordPress and remove unnecessary or unwanted functions and scripts.
- Host: GitHub
- URL: https://github.com/makeitworkpress/wp-optimize
- Owner: makeitworkpress
- License: gpl-3.0
- Created: 2016-04-06T15:33:03.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-11-30T10:54:11.000Z (about 1 year ago)
- Last Synced: 2024-09-26T14:40:53.406Z (3 months ago)
- Topics: wordpress, wordpress-development, wordpress-library, wordpress-optimization, wordpress-php-library
- Language: PHP
- Homepage: https://makeitwork.press/scripts/wp-optimize/
- Size: 69.3 KB
- Stars: 52
- Watchers: 8
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://makeitwork.press/scripts/wp-optimize/).
## 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](https://github.com/makeitworkpress/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);