Hi Bruce,
Actually….I need to reopen this ticket. My assessment was incorrect, and the problem persists regardless of that setting:
Steps to replicate:
– WP 5.9
– Chrome Browser
– Only ‘filester’ plugin installed
– Set the theme to ‘Material’
– Reload the page, the background colors will be set to the default theme
TLDR (more context below the Solution)
SOLUTION:
setting the option in Filester for ‘cssAutoLoad’ to false fixes this – at line 40 in:
/wp-content/plugins/filester/views/pages/html-filemanager.php
Incidentally, in the library, the ” elfinder.legacy.html ” file example has that set to ‘false’ : see it in the code here
Filester’s implementation, however does not. And that is the root of this bug.
Can this please be added to your list for updates in the next version, as right now I need to hack your plugin to fix this..
https://drive.google.com/drive/u/0/folders/1ImoNIQ-19ddY1OrhDlSIknJn64aQ9lZW
—
Showing my work…
What fixed it was something else than I thought, when I closed the ticket…
I had used the WP Hardening plugin to disable the query strings that WordPress adds onto your script, and then the problem was ‘fixed’ – but I don’t want to leave that option enabled, as it causes other issues for the site…
The real issue here is that, although the theme styles are being loaded in the correct order, there is a script in the FileManager library which is loading the default theme *again* with javascript.
Here is the code, from
/wp-content/plugins/filester/includes/File_manager/lib/js/elfinder.full.js
(It actually loads from the .min.js version of course)
// set default theme
if (!self.options.themes.default) {
self.options.themes = Object.assign({
'default' : {
'name': 'default',
'cssurls': 'css/theme.css',
'author': 'elFinder Project',
'license': '3-clauses BSD'
}
}, self.options.themes);
if (!self.options.theme) {
self.options.theme = 'default';
}
}
With that code active, then what happens is that the Chrome browser gives priority to the script without the ‘?ver=5.9″ at the end of i, which is this version loaded with the javascript.
When I set the option ‘cssAutoLoad’ to ‘false’ in the Javascript lib file, then the problem disappears. However since that is a library, and likely used in other projects, the solution is to set that in the PHP file where your plugin loads the library