// Cache Exclude List / Kiri Vadivelu / 2026 function cache_exclude_list() { // Array of slug fragments to exclude from cache $excluded_slugs = [ ‘/red/’, ‘/green/’, ‘/blue/’, ]; // Ensure its a non-empty array if ( ! is_array( $excluded_slugs )…Continue reading
// Cache Exclude Slug / Kiri Vadivelu / 2026 function cache_exclude_slug() { // Match any URL that contains this substring $slug_fragment = ‘/category/’; // partial slug value if ( str_contains( $_SERVER[‘REQUEST_URI’], $slug_fragment ) ) { if ( ! defined( ‘DONOTCACHEPAGE’…Continue reading
// Allow font file uploads (administrators only) add_filter( ‘upload_mimes’, function ( $mimes ) { if ( current_user_can( ‘manage_options’ ) ) { $mimes[‘woff2’] = ‘font/woff2’; $mimes[‘woff’] = ‘font/woff’; } return $mimes; } ); // WordPress double-checks the file type; make sure…Continue reading
add_filter(‘upload_mimes’, function ($m) { $m[‘epub’] = ‘application/epub+zip’; return $m; });Continue reading
add_action( ‘woocommerce_order_status_processing’, function( $order_id ) { if ( ‘yes’ !== get_option( ‘wcvendors_vendor_invoice_enabled’, ‘no’ ) ) { return; } $order = wc_get_order( $order_id ); if ( ! $order ) { return; } // Skip per-vendor child orders — only process the…Continue reading
// WP HTML Minify / Kiri Vadivelu / 2026 add_action(‘template_redirect’, ‘wp_html_minify_start’); function wp_html_minify_start() { // Only minify for front-end HTML pages if (is_user_logged_in() || !is_singular() && !is_home() && !is_front_page()) return; ob_start(‘wp_html_minify_finish’); } function wp_html_minify_finish($html) { $original = $html; // Remove…Continue reading
// Image Type Convert / Kiri Vadivelu / 2026 add_filter( ‘wp_handle_upload’, ‘image_type_convert’ ); function image_type_convert( $upload ) { // Only process images if ( ! isset( $upload[‘type’] ) || ! in_array( $upload[‘type’], [ ‘image/jpeg’, ‘image/png’, ‘image/jpg’ ], true ) )…Continue reading
// Image Quality Scale / Kiri Vadivelu / 2026 function image_quality_scale( $quality, $mime_type ) { if ( ‘image/webp’ === $mime_type ) { return 70; // Webp default 86 } return $quality; } add_filter( ‘wp_editor_set_quality’, ‘image_quality_scale’, 10, 2 );Continue reading
/** * Keep WooCommerce stock identical across the language versions of a product. * * Translations are matched by SKU: , -FR, -ES, -DE, -IT. * This works for simple products, variable products (parent level) and variations. * Only items…Continue reading