add_action( 'init', function() { if ( ! isset( $_SERVER['REQUEST_URI'] ) ) { return; } $path = rtrim( parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ), '/' ); if ( $path === '/blog-grid' ) { wp_redirect( 'https://www.joinstumble.com/blog/', 301 ); exit; } }, 999 ); add_action( 'init', function() { // Remove blog-grid old_slug from demo page 43823 $metas = get_post_meta( 43823, '_wp_old_slug', false ); if ( in_array( 'blog-grid', (array) $metas ) ) { delete_post_meta( 43823, '_wp_old_slug', 'blog-grid' ); } // Ensure blog page 28431 (slug: blog) has blog-grid as old slug for redirect $blog_metas = get_post_meta( 28431, '_wp_old_slug', false ); if ( ! in_array( 'blog-grid', (array) $blog_metas ) ) { add_post_meta( 28431, '_wp_old_slug', 'blog-grid' ); } // Purge LiteSpeed cache for /blog-grid/ so new redirect takes effect if ( class_exists( 'LiteSpeed_Cache_API' ) ) { LiteSpeed_Cache_API::purge( '/blog-grid/'); } elseif ( class_exists( 'LiteSpeed\\Cache\\API' ) ) { \LiteSpeed\Cache\API::purge_url( home_url( '/blog-grid/') ); } }, 1 ); add_action( 'wp_head', function () { // Only run for admins to limit exposure $tp_types = [ 'tp-header', 'tp-footer', 'tp-services', 'tp-offcanvas', 'tp-breadcrumb', 'tp-career', ]; $titles = get_option( 'wpseo_titles', [] ); if ( ! is_array( $titles ) ) { $titles = []; } $changed = false; foreach ( $tp_types as $pt ) { $key_sitemap = 'post_types-' . $pt . '-not_in_sitemap'; $key_noindex = 'noindex-' . $pt; if ( empty( $titles[ $key_sitemap ] ) ) { $titles[ $key_sitemap ] = true; $changed = true; } if ( empty( $titles[ $key_noindex ] ) ) { $titles[ $key_noindex ] = true; $changed = true; } } if ( $changed ) { update_option( 'wpseo_titles', $titles ); // Invalidate Yoast sitemap cache so it regenerates without tp-* types if ( class_exists( 'WPSEO_Sitemaps_Cache' ) ) { WPSEO_Sitemaps_Cache::clear(); } if ( function_exists( 'wpseo_invalidate_sitemap_cache' ) ) { wpseo_invalidate_sitemap_cache(); } } }, 1 ); // DEBUG: Elementor Custom Code is running echo ''; // Write marker file $marker = ABSPATH . 'elementor-test-marker.txt'; file_put_contents($marker, 'snippet-ran-at-' . date('Y-m-d H:i:s'));