/** * Plugin Name: DEALERAUTO — straznik plikow CSS Elementora * Description: Odtwarza brakujace pliki uploads/elementor/css/post-*.css. Bez nich podstrony traca caly uklad (Elementor linkuje plik, ktorego nie ma). ADAWARDS 2026-08-24. * Version: 1.0 * Author: ADAWARDS */ if ( ! defined( 'ABSPATH' ) ) { exit; } function dealerauto_elcss_rebuild_missing() { if ( ! class_exists( '\Elementor\Core\Files\CSS\Post' ) ) { return; } global $wpdb; $upload = wp_upload_dir(); $dir = $upload['basedir'] . '/elementor/css'; if ( ! is_dir( $dir ) || ! is_writable( $dir ) ) { return; } $ids = $wpdb->get_col( "SELECT DISTINCT p.ID FROM {$wpdb->posts} p INNER JOIN {$wpdb->postmeta} m ON m.post_id = p.ID AND m.meta_key = '_elementor_edit_mode' AND m.meta_value = 'builder' WHERE p.post_status IN ('publish','private')" ); $fixed = array(); foreach ( $ids as $id ) { $id = (int) $id; if ( file_exists( $dir . '/post-' . $id . '.css' ) ) { continue; } try { \Elementor\Core\Files\CSS\Post::create( $id )->update(); $fixed[] = $id; } catch ( \Throwable $e ) { continue; } } if ( $fixed ) { update_option( 'dealerauto_elcss_last_fix', array( 'time' => current_time( 'mysql' ), 'ids' => $fixed ), false ); } return $fixed; } // Po kazdym czyszczeniu cache Elementora (aktualizacja wtyczki, zapis ustawien) odbuduj pliki. add_action( 'elementor/core/files/clear_cache', function () { if ( ! wp_next_scheduled( 'dealerauto_elcss_rebuild' ) ) { wp_schedule_single_event( time() + 60, 'dealerauto_elcss_rebuild' ); } } ); add_action( 'dealerauto_elcss_rebuild', 'dealerauto_elcss_rebuild_missing' ); // Straznik cykliczny — tanie file_exists raz na godzine. add_action( 'init', function () { if ( ! wp_next_scheduled( 'dealerauto_elcss_watch' ) ) { wp_schedule_event( time() + 300, 'hourly', 'dealerauto_elcss_watch' ); } } ); add_action( 'dealerauto_elcss_watch', 'dealerauto_elcss_rebuild_missing' ); http://dealerauto.com.pl/post-sitemap.xml 2026-04-30T07:40:57+00:00 http://dealerauto.com.pl/page-sitemap.xml 2026-07-11T08:56:55+00:00 http://dealerauto.com.pl/artykul-sitemap.xml 2026-06-24T10:01:51+00:00 http://dealerauto.com.pl/bestune-sitemap.xml 2026-03-15T11:55:07+00:00 http://dealerauto.com.pl/maxus-sitemap.xml 2026-03-16T00:13:49+00:00 http://dealerauto.com.pl/samochod-sitemap.xml 2026-07-11T07:39:13+00:00 http://dealerauto.com.pl/category-sitemap.xml 2026-06-24T10:01:51+00:00 http://dealerauto.com.pl/samochody-sitemap.xml 2026-07-11T07:39:13+00:00 http://dealerauto.com.pl/author-sitemap.xml 2026-04-30T06:32:53+00:00