Theme directory not writeable for simple-staff-list-custom.css
-
On a client site, I’m seeing lots of error notices like this:
File does not exist: /path/to/wp/wp-content/themes/canvas/simple-staff-list-custom.cssIt looks like your plugin allows users to generate custom CSS in the admin panel, and you then attempt to save it to
get_stylesheet_directory() . '/simple-staff-list-custom.css'. On this particular installation, the Apache user doesn’t have write-access to the theme directory, sofile_put_contents()fails. This results in the feature not working, and also results in errors when a non-existent stylesheet is enqueued insslp_staff_member_enqueue_styles().Two suggestions:
1. Don’t try to save this file in the theme directory. By all means, you should *look* in the theme directory, in case someone ships custom styles with their theme. But don’t try to write there. Instead, write someplace that’ll be reliably accessible: https://teleogistic.net/2013/04/11/wordpress-developers-write-to-the-filesystem-the-right-way/
2. Make sure the file exists before enqueuing it:
if ( get_option( '_staff_listing_write_external_css' ) == "yes" && file_exists( get_stylesheet_directory() . '/simple-staff-list-custom.css' ) ) {
The topic ‘Theme directory not writeable for simple-staff-list-custom.css’ is closed to new replies.