WP HTML Minify

// 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

Schema Single Post

// Schema Single Post / Kiri Vadivelu / 2026 add_action(‘wp_head’, ‘schema_single_post’); function schema_single_post() { if ( ! is_single() ) return; $schema = [ ‘@context’ => ‘https://schema.org’, ‘@type’ => ‘Article’, ‘headline’ => get_the_title(), ‘author’ => [‘@type’ => ‘Person’, ‘name’ => get_the_author()],…Continue reading

Open Graph Meta

// Open Graph Meta / Kiri Vadivelu / 2026 function open_graph_meta() { if (is_singular()) { global $post; $title = get_the_title(); $description = has_excerpt() ? get_the_excerpt() : wp_trim_words($post->post_content, 30); $url = get_permalink(); $image = get_the_post_thumbnail_url($post->ID, ‘large’); $site_name = get_bloginfo(‘name’); echo ‘‘…Continue reading

Scroll Progress Bar

add_action(‘wp_body_open’, function() { echo ‘ ‘; }); add_action(‘wp_head’, function() { echo ‘ ‘; }); add_action(‘wp_footer’, function() { echo ‘‘; });Continue reading

Allowed Referrer Page

// Allowed Referrer Page / Kiri Vadivelu / 2026 add_action(‘template_redirect’, function() { // ID of the page to protect eg. Thank You page if (!is_page(123)) { return; } // URL of the allowed referring page if (wp_get_referer() === ‘https://yoursite.com/form-page/’) {…Continue reading

Exclude Cache Page

// Exclude Cache Page / Kiri Vadivelu / 2026 function exclude_cache_page() { $excluded_urls = array( ‘/client-portal/’, ‘/checkout/’, ‘/cart/’, ); $uri = parse_url( $_SERVER[‘REQUEST_URI’], PHP_URL_PATH ); foreach ( $excluded_urls as $url ) { if ( strpos( $uri, $url ) !== false…Continue reading

Exclude Caching Page

// Exclude Caching Page / Kiri Vadivelu / 2026 function exclude_caching_page() { $excluded_pages = array( 6, 57, 103 ); // ← your page IDs here if ( is_page( $excluded_pages ) ) { if ( ! defined( ‘DONOTCACHEPAGE’ ) ) {…Continue reading

Debug Load Email

// Debug Load Email / Kiri Vadivelu / 2026 add_action( ‘template_redirect’, ‘page_load_email’ ); function page_load_email() { $to = “[email protected]”; // Replace with your email $subject = ‘wp_mail function test’; $message = ‘This is a test of the wp_mail function: wp_mail…Continue reading

Page Load Email

// Page Load Email / Kiri Vadivelu / 2026 add_action( ‘template_redirect’, ‘page_load_email’ ); function page_load_email() { // Only on the front end page load $to = ‘[email protected]’; // Replace with your email $subject = ‘Page Load Email Test’; $message =…Continue reading

Disable All Search

// Disable All Search / Kiri Vadivelu / 2026 function disable_search_query( $query, $error = true ) { if ( is_search() && !is_admin() ) { $query->is_search = false; $query->query_vars[‘s’] = false; $query->query[‘s’] = false; if ( $error ) { $query->is_404 =…Continue reading