Support » Plugin: Merge + Minify + Refresh » Unable to override MMR_CACHE_DIR and MMR_CACHE_URL

  • Resolved virgodesign

    (@virgodesign)


    Hi,

    I’ve mmr installed in a wordpress (4.7.5) network installation, and mmr (1.8.6) is networkwide activated.

    It seems that there’s no way to customize the MMR_CACHE_DIR and MMR_CACHE_URL constants.
    I’ve tried using the muplugins_loaded action but if the plugin is network activated, it will be loaded before this action fires.

    The only possible way is using wp-config.php file but, at this state, the WP_CONTENT_URL and WP_CONTENT_DIR are not yet defined, and became tricky to have a strong and correct constants declaration.

    I would suggest to define mmr dirs and urls constants after the mupluginsloaded and plugins_loaded action hooks. For example using the after_setup_theme action hook.

    Thank you very much in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author launchinteractive

    (@launchinteractive)

    Hi Virgodesign,

    I never tested this. What exactly are you trying to achieve? Do you want to specify the CACHE_DIR/URL separately or the same for both sites?

    Thread Starter virgodesign

    (@virgodesign)

    Hi,

    I wish to change the default mmr folder and store all minified files in a custom folder, for example, I wish to define my custom folder as following:

    A) define( 'MMR_CACHE_DIR', WP_CONTENT_DIR.'/cache/files');
    B) define( 'MMR_CACHE_URL', WP_CONTENT_URL.'/cache/files');

    My scenario is that MMR is network activated and all sites (in subdomains) shares the same folder. And this is ok.

    The problem is that it’s not possible to define these constants before mmr defines them.

    The possible solutions are:
    1. defines constants A and B in wp-config.php file. Problem: WP_CONTENT_DIR/URL are not defined at this state.
    2. defines constant A and B within a wordpress action hook. Problem: the only available hook is muplugins_loaded but mmr loads before this hook is fired, because is network activated.

    The only working way I found is creating a custom mu-plugin and defines there constants A and B. At this level we could also customize MMR_JS_CACHE_URL and MMR_CSS_CACHE_URL

    What I’m trying to say is that, it seems that there is no really way to define a custom mmr folder BEFORE mmr defines it.

    Considering that we can use thi plugin toghether with other caching plugins I think that would be more powerful to have an easy way to define a custom mmr folder.

    Thank you very much for the attention.

    Plugin Author launchinteractive

    (@launchinteractive)

    Ok, I see what you mean.

    Just out of curiosity.. if you manually type the full path in wp-config does MMR work correctly?

    Thread Starter virgodesign

    (@virgodesign)

    Yes it works correctly.

    Plugin Author launchinteractive

    (@launchinteractive)

    Hi virgodesign,

    I’ve been thinking about this and I think this is acceptable to have to set the complete path manually rather than using the WP_CONTENT_… constants. We could possibly hook in later for our defines but its a bit of work that I don’t think is necessary and not many people will use.

    I’ll mark this as resolved but reply if you think otherwise.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Unable to override MMR_CACHE_DIR and MMR_CACHE_URL’ is closed to new replies.