post_content)) ? (string) $post->post_content : ''; if ('' !== $content && (false !== strpos($content, 'ya-map') || has_shortcode($content, 'map'))) { return true; } return (bool) apply_filters('dekart_page_has_map', false); } // 1) SVG Support CSS не нужен: тема не стилизует .attachment/.widget_media_image svg add_action('wp_enqueue_scripts', static function () { if (is_admin()) { return; } wp_dequeue_style('bodhi-svgs-attachment'); }, 100); // 2) CSS карт/виджетов — только там, где есть карта (снимаем на остальных страницах) add_action('wp_enqueue_scripts', static function () { if (is_admin() || dekart_page_has_map()) { return; } global $wp_styles; if (! $wp_styles instanceof WP_Styles) { return; } // Подстроки в URL стилей карт/виджетов $patterns = (array) apply_filters('dekart_map_css_patterns', array( 'api-maps.yandex', 'maps.yandex', 'maps.googleapis', 'maps.google', 'maptiler', 'leaflet', 'openstreetmap', )); foreach ($wp_styles->registered as $handle => $style) { $src = (string) $style->src; if ('' === $src) { continue; } foreach ($patterns as $needle) { if (false !== stripos($src, $needle)) { wp_dequeue_style($handle); break; } } } }, 100);