Last active
March 5, 2019 20:37
-
-
Save davidsword/e699adaadb616d7ff2ac727ecd3c91c5 to your computer and use it in GitHub Desktop.
WordPress - Jetpack: Enable lazyload Module via functions.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Some Jetpack modules can be manually loaded. | |
* | |
* Here's an example of how to enable Lazy Images via code instead of database. | |
* | |
* @see https://github.com/Automattic/jetpack/blob/593ee4cccd6aead047c72aa78378f368f084035e/modules/lazy-images.php#L27 | |
*/ | |
if ( defined( 'JETPACK__PLUGIN_DIR' ) ) { | |
require_once( JETPACK__PLUGIN_DIR . 'modules/lazy-images/lazy-images.php' ); | |
add_filter( 'lazyload_is_enabled', '__return_true' ); | |
add_action( 'wp', array( 'Jetpack_Lazy_Images', 'instance' ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment