This file contains 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 | |
defined( 'ABSPATH' ) or die( 'Cheatin’ uh?' ); | |
/** | |
* Plugin Name: WP Rocket | LazyLoad Mobile | |
* Description: Enable LazyLoad only for mobile | |
* Author: WP Rocket Support Team | |
* Author URI: http://wp-rocket.me/ | |
* License: GNU General Public License v3 or later | |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html | |
*/ |
This file contains 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 | |
function wp_rocket_add_images( $file_types ) { | |
$file_types[] = 'jpg'; | |
$file_types[] = 'gif'; | |
$file_types[] = 'png'; | |
return $file_types; | |
} | |
add_filter( 'rocket_cdn_custom_filetypes', 'wp_rocket_add_images' ); |
This file contains 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 | |
add_filter('rocket_htaccess_mod_expires', 'wp_rocket_remove_html_expire_dreampress'); | |
/** | |
* Remove expiration on HTML to prevent issue with Varnish cache | |
* | |
* @param string $rules htaccess rules. | |
* @return Updated htaccess rules | |
*/ | |
function wp_rocket_remove_html_expire_dreampress( $rules ) { |
This file contains 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 | |
defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' ); | |
/** | |
* Remove expiration on HTML to prevent issue with Varnish cache | |
* | |
* @author Remy Perona | |
* | |
* @param string $rules htaccess rules. | |
* @return Updated htaccess rules |
This file contains 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 | |
function rocket_disable_rewrite_amp() { | |
if ( defined( 'AMP_QUERY_VAR' ) && function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) { | |
// this filter is documented in inc/front/protocol.php | |
$do_rocket_protocol_rewrite = apply_filters( 'do_rocket_protocol_rewrite', false ); | |
if ( ( get_rocket_option( 'do_cloudflare', 0 ) && get_rocket_option( 'cloudflare_protocol_rewrite', 0 ) || $do_rocket_protocol_rewrite ) ) { | |
remove_filter( 'rocket_buffer', '__rocket_protocol_rewrite', PHP_INT_MAX ); | |
remove_filter( 'wp_calculate_image_srcset', '__rocket_protocol_rewrite_srcset', PHP_INT_MAX ); |
This file contains 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 | |
add_filter( 'rocket_cache_busting_filename', 'wp_rocket_filter_cache_busting_filename' ); | |
function wp_rocket_filter_cache_busting_filename( $filename ) { | |
$filename = str_replace( '../', '', $filename ); | |
return $filename; | |
} |
This file contains 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
function wp_rocket_cache_feed( $uri ) { | |
$feed = '/(.+/)?' . $GLOBALS['wp_rewrite']->feed_base . '/?'; | |
if ( in_array( $feed, $uri ) ) { | |
$uri = array_flip( $uri ); | |
unset( $uri[ $feed ] ); | |
$uri = array_flip( $uri ); | |
} | |
return $uri; | |
} |
This file contains 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 | |
/** | |
* Plugin Name: No cache after logged-in user comment | |
* Description: Don't use cache after a user made a comment | |
* Author: WP Rocket team | |
* License: GNU General Public License v3 or later | |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html | |
*/ | |
// Basic security, prevents file from being loaded directly. |