• I need to use the function file_put_contents to overwrite a file with whole new content or append contents several times in some cases. But I know that the function is not allowed to use in WordPress themes.

    So I would like to use $wp_filesystem->put_contents instead, but it seems the WP function does not have the argument to choose whether to append content several times into a file or to overwrite a file with new one.

    I need some CSS, which is created lately and dynamically in a widget function(add class names to some elements & calculate CSS according to them) after all the other styles are already loaded. So I cannot use wp_add_inline_style, which is loaded before that. So, I absolutely need an alternative function for file_put_contents which has an argument to choose appending or replacing.

    Please help!

The topic ‘Does "$wp_filesystem->append_contents" or something exist?’ is closed to new replies.