• Hey I am using w3 total cache and cloudflare together. I have the following code in my child thems functions.php

    function my_deregister_styles() {
        wp_dequeue_style( 'contact-form-7');
        wp_dequeue_style( 'font-awesome');
    
        wp_dequeue_style( 'main-styles');
        wp_dequeue_style( 'magnific');
        wp_dequeue_style( 'responsive');
    
        wp_dequeue_style( 'select2-css');
        wp_deregister_style( 'redux-google-fonts-');
        wp_deregister_style( 'skin-ascend');
        wp_deregister_style( 'js_composer_front');
        wp_deregister_style('rgs');
    
        wp_deregister_style('font-awesome');
    
        wp_deregister_style("main-styles");
    
        wp_deregister_style("responsive");
        wp_deregister_style("select2");
    
        wp_deregister_style("skin-ascend");
    
    }
    
    add_action( 'wp_print_styles',     'my_deregister_styles', 100 );
    
    function disable_wp_emojicons() {
    
      // all actions related to emojis
      remove_action( 'admin_print_styles', 'print_emoji_styles' );
      remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
      remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
      remove_action( 'wp_print_styles', 'print_emoji_styles' );
      remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
      remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
      remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
    
      // filter to remove TinyMCE emojis
      add_filter( 'tiny_mce_plugins', 'disable_emojicons_tinymce' );
    }
    add_action( 'init', 'disable_wp_emojicons' );
    
    function disable_emojicons_tinymce( $plugins ) {
      if ( is_array( $plugins ) ) {
        return array_diff( $plugins, array( 'wpemoji' ) );
      } else {
        return array();
      }
    }
    
    ?>

    If the cosde is not present w3 toal cache refreshes the page without any problems. The cahce itself is flushed though. Do you have an idea what setting I would have to change to actually get the page to refresh again. At the moment it just gets stuck and the screen remains white.
    Thank you very much!

    All the best

    Tino

    https://ww.wp.xz.cn/plugins/w3-total-cache/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Ashok

    (@bappidgreat)

    Hello Tino

    That code is deregistering some styles and scripts. If you don’t need those, why were those added then?

    Also,
    1. when you see white page, and then refresh again, is the site back?
    2. Are you using auto or manual mode for minify?
    3. Would you please enable debug mode and check if any error is shown in that page?

    To enable debug mode please edit a line in your wp-config.php:
    Change

    define('WP_DEBUG', false);

    to

    define('WP_DEBUG', true);

    Please let us know what errors you see there.

    Have a good day!

    Cheers
    Ash

    Thread Starter schlafcola

    (@schlafcola)

    Thanks Ash for the response, here are the answers:

    The reason why I am deregistering the styles is that I am actually using the minified version of the combined css file that w3 total cache has provided and inline the whole css in the header.php file. I let w3 total cache do its css minification job and then disable the css minification all together. Then I deregister all the styles and just add this code to the header:

    <style type="text/css">
    <?php
    $css = file_get_contents('https://www.mysite.com/wp-content/themes/salient-child/default.include.5f65ec.css');
    
    echo $css;
    ?>
    </style>

    1. No a second refresh does not bring the site back. The cash is flushed though.

    2. I am using manual mode for minification

    3. Here is the debug mode output:

    Warning: _() expects exactly 1 parameter, 2 given in /www/htdocs/v095996/websites/kristalfit/wp-content/themes/salient/nectar/nectar-vc-addons/nectar-addons.php on line 4173

    I will look into this error but it seems to have nothing to do with the w3 total chache plugin.

    Thanks again for the help!

    Cheers

    Tino

    Thread Starter schlafcola

    (@schlafcola)

    Hey Ash, I hope to hear back from you on this topic, I have found out something by myself. As soon as I am writing any code into the functions.php file. I am not able to refresh the w3 total cach plugin.
    A few more insights about my configuration:
    I am using a child theme
    I am minifying with the child theme selected
    I am writing into the functions.php of the child theme

    Thank you very much!

    Tino

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘code in functions.php stops refreshing the page when cache is emptied’ is closed to new replies.