Skip to content

Instantly share code, notes, and snippets.

View jbma's full-sized avatar

Jean-Baptiste Marchand-Arvier jbma

View GitHub Profile
<?php
require ('wp-load.php');
$id_post = esc_html($_GET['id_post']);
rocket_clean_post($id_post);
<?php
function clear_remote_wp( $ID, $post ) {
wp_remote_get('http://defimedia.info/custom-clear.php?id='.$ID);
}
add_action( 'publish_post', 'clear_remote_wp', 10, 2 );
<?php
add_filter( 'wp', '__deactivate_rocket_lazyload_if_admin' );
function __deactivate_rocket_lazyload_if_admin()
{
if( is_admin() ) {
add_filter( 'do_rocket_lazyload', '__return_false' );
}
}
<?php
add_filter('rocket_htaccess_marker', '__return_false');
<?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/'):
}
<?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
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
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
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' );
}
}