This topic has 38 replies, 5 voices, and was last updated 6 years by Trey.

  • Author
  • #110427
     wacha
    Participant

    Hello,

     

    I have a strange problem. Sometimes my website load perfectly and sometimes not.

    After some reseach i found that sometimes my dynamic.css don’t load because of a 404 error.

    Did you already saw this problem ?

     

    Best regards

    Jérémy

    Attachments:
    You must be logged in to view attached files.
    #110518
     Radu
    Moderator

    Hi,

    Go to wp-content/uploads/ and give 755 permission to that folder custom_styles.

    This css file is generated when you press save settings from theme options and visit homepage of site.

    Let me know

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #110937
     wacha
    Participant

    Hi Radu,

    Thank you for this fast answer.
    I made the permission change but i still have the same issue.
    Sometimes the css load perfectly some other not.
    (I don’t have any cache plugin).

    Regards

    #111033
     Radu
    Moderator

    I see that you have 4.0.1 theme version please update the theme to 4.0.3 then you should update the plugins to, check form wp-admin -> appearance -> install plugins.

    Let me know if the update will solve your issue.

    Cheers

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #111200
     wacha
    Participant

    Dear Radu,

    How can i know that there is an update because wordpress didn’t tell me about your update ?

    Thank you,
    Jérémy

    #111206
     wacha
    Participant

    Update for theme & plugin done but i have still the same problem.

    Thank you Radu,
    Jérémy

    #111353
     Radu
    Moderator

    Can you please provide credentials to take a look ?

    FTP and Wp-admin credentials

    Cheers

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #111361
     wacha
    Participant
    This reply has been set as private.
    #111560
     Radu
    Moderator

    Hi,

    Did you had installed any cache plugin before this issue ? Or you have used cache service like cloudflare ?

    Let me know

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #111568
     wacha
    Participant

    Hello Radu,

    I have w3 total cache witch i installed AND disable before the installation of kleo.

    Thank you,
    Jérémy

    #112227
     Andrei
    Moderator

    Hi @wacha,

    This might happen only and only when you make some changes to the theme options and you have some caching systems enabled on your site. So after you’ve made any changes to the theme, please be sure you clear all your cache systems.

    We’ll try to make some improvements in next updates to find a workaround for this common caching behavior.

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #112233
     wacha
    Participant

    Hi andrei,

    As i said i disable before the installation of kleo.
    Moreover i just delete the plugin.

    So i have no cache problem right now.

    As far as i know with this bug :
    – without making any change to the backoffice of wordpress just by refreshing the same page the dynamic.css sometimes load and someother time is 404.

    What can i do ?

    Thank you

    #112234
     wacha
    Participant
    #112717
     Andrei
    Moderator

    In that user case the issue comes from the fact that she had some caching systems activated, that’s why I firstly recommended you to check your cache settings.

    I will need some extra time to investigate a little bit more about what’s happening in your case.

    I’ll let you know once I have any news. Please let the ftp credentials available.

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #112741
     wacha
    Participant

    Andrei,

    Thank you for your answer.

    Just want to let you know that while working on the site i temporarily copy all dynamic.css in a tmp.css that i load from a direct link.

    #114319
     Andrei
    Moderator

    Thanks for the tip. I’ll keep you updated on how this goes, we’ll gonna give a closer look into this issue in the following days to see if the issue comes from the theme or from some hosting environment settings.

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #118641
     wacha
    Participant

    Hello,

    One month have past since your last message and i still having this issue.
    Do you have find something ?

    Thank you,
    Jérémy

    #118831
     Abe
    Keymaster

    Hi there, we already fixed that and should be available in KLEO 4.0.6

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #118962
     wacha
    Participant
    This reply has been set as private.
    #119024
     Abe
    Keymaster

    I just looked at your site and there is not 404 for the dynamic css resource

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #119036
     wacha
    Participant

    Dear Abe,

    It’s not happen all the time it can be once every or twice every 10 pages.
    And as i said earlier check the css loaded because i force to load all the kleo style with a tmp.css to solve the problem.

    Best regards

    #119086
     Abe
    Keymaster

    I see you are using a lots of modifications and the css is loaded in the header and the dynamic css is not even registered. Please make sure you have the latest theme update and disable any extra plugins or caching.

    The thing is that KLEO only regenerates the dynamic css when you re-save theme options, otherwise it does not get removed.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #119193
     wacha
    Participant

    Hello Abe,

    Ok i’ll check this out.
    Can you tell me few things about your theme.
    1/ Why sometimes styles are included by dynamic.css and why sometimes it’s included inline ?
    2/ Can you explain me this “the dynamic css is not even registered” ? What is a registered css ?
    3/ Dynamic.css is only generate when re-saving theme option or when the site is loaded and the file didn’t exist ?

    Thank you for your help !
    Jérémy

    #119194
     wacha
    Participant

    And one more :

    Do /wp-content/uploads/custom_styles/ folder need special permission ?

    Thank you !

    #119284
     Abe
    Keymaster

    Maybe you don’t have write permission to the /wp-content/uploads/custom_styles/ folder
    if is rendered inline then it is not registered as a css file that loads
    If the file does not exist the it will try to generate it and the file is deleted when theme options is changed

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #119436
     wacha
    Participant

    2/ Can you explain me this “the dynamic css is not even registered” ? What is a registered css ?

    #119557
     Abe
    Keymaster

    if is rendered inline then it is not registered as a css file that loads

    Example of css style

    COPY CODE
    
    <link rel='stylesheet' href='//seventhqueen.com/support/wp-content/plugins/bbpress-vip-support-plugin/templates/css/bbps-style.css' type='text/css' media='all'/>
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #151109
     wacha
    Participant

    Hello,

    After all this month i still have this problem.
    As you can see, sometimes the dynamic.css is generated, sometimes it’s a 404.

    Try by resfreshing this url few times :
    https://www.mycake.fr/wp-content/uploads/custom_styles/dynamic.css?ver=4.1.7

    Any advice ?

    #151111
     Abe
    Keymaster

    @wacha please see if the file exists on the location wp-content/uploads/custom_styles/dynamic.css via Ftp or file manager from cpanel. when a 404 is given try to see on the server it that is actually there.

    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #151112
     wacha
    Participant

    Sometimes it’s here and sometimes it’s not 🙂

    #151113
     Abe
    Keymaster

    The file is regenerated only after you re-save theme options or customizer. Make sure you don’t have any custom codes added that can trigger that.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #161800
     Trey
    Participant

    I’ve been trying to track this down as well for the last couple of weeks. It seems completely random, none of the settings screens are open when it happens. We don’t have any caching plugins, and the directory is writable by wordpress. I guess something is triggering the file to be regenerated and the front end is getting loaded at that precise moment, before the file is finished saving. It seems that this could be easily fixed in the dynamic-css.php file by adding a file_exists check to the wp_is_writable check on line 29.

    In the interim, I’ve just added this to my child theme, so far so good.

    COPY CODE
    if ( ! is_admin() && has_action( 'wp_enqueue_scripts', 'kleo_load_dynamic_css' )) {
        global $kleo_config;
        if(!file_exists(trailingslashit( $kleo_config['custom_style_path'] ) . 'dynamic.css')){
            remove_action( 'wp_enqueue_scripts', 'kleo_load_dynamic_css', 22 );
            add_action( 'wp_head', 'kleo_custom_head_css' );
        }
    }
    #161817
     Trey
    Participant

    Ok, I tracked down where it happens. It triggers after admin-init, so even on the front end if there is an ajax call. In /kleo-framework/options/framework.php the _register_settings method triggers it when it’s checking for “wrong” media URLs. We serve ALL of our media from S3, so the check to see if its URL contains the WP_CONTENT_URL ALWAYS fails, meaning that it is constantly regenerating the file.

    I removed the files and it solved the problem completely. I was able to check because if I pressed enter in the search box the dynamic.css file was never loaded (the live search feature uses ajax which triggers admin-init and deletes the old file), made it much easier to track down when I could replicate the problem.

    #162314
     Abe
    Keymaster

    hi @trey
    So the fix in your case was the above code?
    we do have a file_exist check.
    see line 22 from lib/dynamic-css.php
    if ( $needs_update || ! file_exists ( trailingslashit( $kleo_config[‘custom_style_path’] ) . ‘dynamic.css’ ) ) {

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #162320
     Trey
    Participant

    No, actually after some more testing that didn’t work. The problem was that any ajax callback was triggering the file to be regenerated, so if any user used the header search, or facetwp, or loaded an admin page, the file was deleted and rebuilt. The issue was that sometimes another page would be loaded before Kleo was finished writing the new file. As I said in my last comment, the source of the problem was us using S3 to host our icon and logo. The check determines that those files aren’t local and flags the CSS for update. I just put the link to a local file there instead and it “fixed” the problem.

    It would be easier to diagnose if when the framework determined that the CSS needed to be rebuilt due to a setting it thinks is “wrong”, it put up a message on the admin side explaining what triggered the rebuild, even if this was only done when debug mode was on. It never let me know that it expected those images to be local files, which could also just be added into the field description.

    #162322
     Trey
    Participant

    To elaborate, the S3 plugin alters the file URL to point to S3, so it is a valid media resource, with an attachment ID, but the framework thinks that since it has an attachment ID, and the URL is NOT local, it must be wrong, so it tried to get the image URL again and flag the CSS for rebuild, when that happens, S3 again changes the URL to point to the correct file and the next time that an admin endpoint is loaded it goes through the process again. This could also be mitigated by only flagging the css for update when someone actually loads the theme options, instead of every single admin URL

    #162323
     Trey
    Participant

    Incidentally, the issue is here:

    kleo/kleo-framework/options/framework.php line 450:

    The method “set_default_args”, which is called from the construct magic method, sets “opt_name” to a blank string. This is altered in the subsequent filters in construct to contain what I’m guessing is the name of the activated theme (because mine is a child theme).

    then on

    kleo/kleo-framework/options/framework.php line 258:

    it checks to see if that array value ($this->args['opt_name']) is empty, which it is not, so it continues to line 355, where it adds the admin_init hook to call the _register_settings method, which is where the framework determines if the CSS needs to be updated.

    So, in fact, your comment that:
    “The file is regenerated only after you re-save theme options or customizer.”

    is incorrect. The file is regenerated if _register_settings thinks it needs to be on ANY admin page load.

    #162538
     Abe
    Keymaster

    Hi, the removal process happens only with this function: kleo_write_dynamic_css_file() that is called when the theme options or the customizer are saved.

    On every request indeed there is a check for the file if it exists and if it doesn’t exist then it will be generated with this function kleo_generate_dynamic_css() but this one doesn’t delete the file.

    I am trying to see why this happens but it doesn’t make sense. If the URL is changed by the plugin and on our file_exists check it fails to find it then it will try to create it but not delete it. And if it was trying to delete it, it couldn’t since the path is changed with the S3..

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #162689
     Trey
    Participant

    The URL to the stylesheet isn’t changed. It’s the logo and favicon attachments, the theme expects them to be in a local directory.

    If you walk through my last post you will see that, in fact, kleo_write_dynamic_css_file() is called any time an admin page is loaded when the ReduxFramework::_register_settings() method determines it needs to be.

    It sets a flag to do an update here:
    File: /kleo-framework/options/framework.php
    Lines: 2212-2284

    If I can find time I’ll try to set up a backtrace and post it later.

    Install WP Offload S3 and upload a logo, you can add some debug output to the kleo_write_dynamic_css_file() function and see that it triggers every time an admin page is loaded.

Viewing 39 posts - 1 through 39 (of 39 total)

The forum ‘Bugs & Issues’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?