Plugin Directory

Changeset 3293437


Ignore:
Timestamp:
05/14/2025 05:21:04 PM (8 months ago)
Author:
vortica
Message:

Version 3
removes the include of the css into the preview when edition css in the backoffice

Location:
custom-css-to-external-file/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • custom-css-to-external-file/trunk/custom-css-to-external-file.php

    r3290004 r3293437  
    44Plugin URI: https://vortica.net/custom-css-to-external-file
    55Description: Moves the Custom CSS from the WordPress Customizer to an external file and includes it in the site's head to improve performance and persistence.
    6 Version: 2.0
     6Version: 3.0
    77Author: Vortica
    88Author URI: https://vortica.net/
     
    1717function ccsef_activate_plugin() {
    1818    update_option('ccsef_external_active', 1);
    19     ccsef_save_customizer_css_to_file(); // Save CSS to file immediately
     19    ccsef_save_customizer_css_to_file();
    2020}
    2121register_activation_hook(__FILE__, 'ccsef_activate_plugin');
     
    3838add_action('customize_save_after', 'ccsef_save_customizer_css_to_file');
    3939
    40 // Enqueue the external CSS file instead of inline
     40// Enqueue the external CSS file (not during Customizer live preview)
    4141function ccsef_enqueue_customizer_css_file() {
     42    // Do not include external CSS during Customizer live preview
     43    if ( is_customize_preview() ) return;
     44
    4245    $is_active = get_option('ccsef_external_active', false);
    4346    if (!$is_active) return;
    4447
    45     // Only remove inline CSS when not in Customizer live preview
    46     if ( ! is_customize_preview() ) {
    47         remove_action('wp_head', 'wp_custom_css_cb', 101);
    48     }
     48    // Remove default inline CSS output
     49    remove_action('wp_head', 'wp_custom_css_cb', 101);
    4950
    5051    $upload_dir = wp_upload_dir();
  • custom-css-to-external-file/trunk/readme.txt

    r3293423 r3293437  
    55Tested up to: 6.8.1
    66Requires PHP: 7.0
    7 Stable tag: 2.0
     7Stable tag: 3.0
    88License: GPL2
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.