Skip to content

Commit

Permalink
Merge pull request #84 from marcissimus/unlink_warning
Browse files Browse the repository at this point in the history
Avoid warning when unlinking custom-styles.css
  • Loading branch information
marcissimus committed Mar 13, 2024
2 parents c58b671 + 78769f8 commit b698774
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion code/admin/suffusion-options-page.php
Expand Up @@ -161,7 +161,10 @@ function suffusion_save_css_to_file($custom_css = array()) {
}

if (is_array($custom_css) && isset($custom_css['css'])) {
unlink($filename); // pre-empty
// Avoid warning if file does not exist
if (is_file($filename)) {
@unlink($filename); // pre-empty
}
if (!$wp_filesystem->put_contents($filename, $custom_css['css'], FS_CHMOD_FILE)) {
echo "<div class='error'><p>Failed to save file $filename. Please check your folder permissions.</p></div>";
}
Expand Down

0 comments on commit b698774

Please sign in to comment.