“Please bring back cache location setting” was the topic title 1 year and 3 months ago here:
As an answer for a user request changing the cache location was enabled for developers. As in the change log for v 5.0.6 is written: “For most of you nothing will change, but omgf_upload_dir and omgf_upload_url filters are available for DEVs who want to modify the default value, although I really can’t think of a reason why you’d want to do that.”
That is exactly the solution I need for our special case, where many websites share the same WP installation, but not as a commonly known multi-site, rather simply using the same web-space, WP directories and files (and different databases), so the cache can be unfortunately mixed between those websites, resulting in some odd side effects, like not always showing the right Fonts.
My goal is to separate OMGF cache for every website, in their own folders named by their domain names. The problem is if I try to use omgf_upload_dir and omgf_upload_url filters, although no error is registered, the cache folder remains unchanged. In the WP database the option for omgf reveals unchanged paths for the generated cache, meaning something is not working right.
I found omgf_upload_dir and omgf_upload_url in the initialization part of the code ( public function define_constants() ) and also checked if theyare really working, and confirmed that they do work. However I don’t have time to investigate further why is it not changing the cache path.
My code added to functions.php in a child theme looks something like this:
function omgf_modify_upload_dir($content_dir) {
global $domainname; //dinamically generated for the actual website outside from this function
$content_dir = WP_CONTENT_DIR . '/cache/omgf/' . $domainname;
return $content_dir;
}
add_filter( 'omgf_upload_dir', 'omgf_modify_upload_dir', 10, 1 );I do a similar simple modification of omgf_modify_upload_url.
Do you have an explanation maybe?
