| @@ -102,5 +102,27 @@ | ||
| 102 | 102 | |
| 103 | 103 | // update the options. |
| 104 | 104 | update_option( 'srfm_default_dynamic_block_option', $previous_options ); |
| 105 | 105 | } |
| 106 | + | |
| 107 | + /** | |
| 108 | + * Clear Elementor's cached per-page asset list so pages built before the Payment | |
| 109 | + * History widget declared its stylesheet dependency pick up the new head-loaded CSS. | |
| 110 | + * | |
| 111 | + * Elementor only recomputes `_elementor_page_assets` on document save, so without | |
| 112 | + * this a page built with the widget in 2.12.2 keeps loading the CSS at render time | |
| 113 | + * (footer → FOUC) after the update until it is re-saved in the editor. Dropping the | |
| 114 | + * meta forces Elementor to regenerate it (including this dependency) on next render. | |
| 115 | + * | |
| 116 | + * @since 2.12.3 | |
| 117 | + * @return void | |
| 118 | + */ | |
| 119 | + public static function clear_elementor_page_assets_cache() { | |
| 120 | + // Deliberately NOT gated on class_exists( '\Elementor\Plugin' ). Updater::init() | |
| 121 | + // writes the version marker unconditionally, so this callback runs exactly once — | |
| 122 | + // and if Elementor happens not to be loaded in that particular request, the cache | |
| 123 | + // would never be cleared and every pre-existing Elementor page would keep | |
| 124 | + // footer-loading the CSS forever. delete_post_meta_by_key() is a harmless no-op on | |
| 125 | + // sites that never used Elementor, so the guard bought nothing. | |
| 126 | + delete_post_meta_by_key( '_elementor_page_assets' ); | |
| 127 | + } | |
| 106 | 128 | } |