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 | |
//increase max execution time of this script to 150 min: | |
ini_set('max_execution_time', 9000); | |
//increase Allowed Memory Size of this script: | |
ini_set('memory_limit','960M'); | |
// Copies woocommerce orders and users over from source to target. | |
// I use this on my local machine - loading both db's up there side by side | |
// could easily adjust the connect strings to connect elsewhere if needed. |
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 | |
/** | |
* Disable WooCommerce block styles (front-end). | |
*/ | |
function slug_disable_woocommerce_block_styles() { | |
if( function_exists( 'is_woocommerce') ) { | |
if( !is_woocommerce() && !is_cart() && !is_checkout() ) { | |
wp_dequeue_style( 'wc-block-style' ); | |
wp_dequeue_style( 'wp-block-library' ); | |
wp_dequeue_style( 'woocommerce-layout' ); |
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 generate_webp_from_file($file, $compression_quality = 80) { | |
// check if file exists | |
if (!file_exists($file)) { | |
return false; | |
} | |
// If output file already exists return path | |
$output_file = $file . '.webp'; | |
if (file_exists($output_file)) { |
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('w3tc_process_content', function( $content ) { | |
preg_match_all( "/<script(?:[^>]*)>(?<content>[\s\S]*?)<\/script>/ims", $content, $matches, PREG_SET_ORDER ); | |
foreach ( $matches as $code ) { | |
if ( strpos( $code['content'], 'jQuery(' ) === false ) { | |
continue; | |
} | |
if ( strpos( $code['content'], 'DOMContentLoaded' ) !== false ) { | |
continue; |