Skip to content

Instantly share code, notes, and snippets.

View jbma's full-sized avatar

Jean-Baptiste Marchand-Arvier jbma

View GitHub Profile
<?php
add_filter( 'rocket_minify_excluded_external_js', '__fix_wprocket_excluded_external_js' );
function __fix_wprocket_excluded_external_js( $external_js ) {
$external_js[] = 'google.com';
return $external_js;
}
<?php
if( current_user_can('administrator') ){
define('DONOTCACHEPAGE', true);
}
<?php
add_filter( 'rocket_minify_excluded_external_js', '__fix_wprocket_excluded_external_js' );
function __fix_wprocket_excluded_external_js( $external_js ) {
$external_js[] = 'ir-de.amazon-adsystem.com';
return $external_js;
}
<?php
if (isset($_GET['min_price']) or isset($_GET['max_price']) ){
define('DONOTCACHEPAGE', true);
}
<?php
add_filter( 'wp', '__deactivate_rocket_lazyload_if_only_content' );
function __deactivate_rocket_lazyload_if_only_content()
{
if( isset($_GET['content-only']) && $_GET['content-only'] == 1 ) {
add_filter( 'do_rocket_lazyload', '__return_false' );
}
}
<?php
if ( ! wp_next_scheduled( 'clear_home_page_hourly' ) ) {
wp_schedule_event( time(), 'hourly', 'clear_home_page_hourly' );
}
add_action( 'clear_home_page_hourly', 'clear_home_page' );
function clear_home_page() {
rocket_clean_home();
}
<?php
function custom_browser_cache(){
$rules = '# Expires headers (for better cache control)' . PHP_EOL;
$rules .= '<IfModule mod_expires.c>' . PHP_EOL;
$rules .= 'ExpiresActive on' . PHP_EOL . PHP_EOL;
$rules .= '# Perhaps better to whitelist expires rules? Perhaps.' . PHP_EOL;
$rules .= 'ExpiresDefault "access plus 1 month"' . PHP_EOL . PHP_EOL;
$rules .= '# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)' . PHP_EOL;
$rules .= 'ExpiresByType text/cache-manifest "access plus 0 seconds"' . PHP_EOL . PHP_EOL;
<?php
defined( 'ABSPATH' ) or die( 'Cheatin\' uh?' );
/*
Plugin Name: Add suPHP
Author: Jonathan (WP Rocket Team)
Author URI: http://wp-rocket.me
*/
add_filter( 'before_rocket_htaccess_rules', '__rocket_add_su' );
function __rocket_add_su( $marker ) {
$redirection = 'suPHP_ConfigPath /home/shaman2/public_html/' . PHP_EOL;
<?php
if ( ! wp_next_scheduled( 'rocket_clear_cache_task' ) ) {
wp_schedule_event( time(), 'twicedaily', 'rocket_clear_cache_task' );
}
add_action( 'rocket_clear_cache_task', 'rocket_clear_cache_image' );
function rocket_clear_cache_image() {
rocket_clean_files('http://www.spa-villa.de/hotel/wellness-suiten/'):
}