Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter juliosene

    (@juliosene)

    Update: I have already build a PHP script to make all changes that I need at “master.php” file. Now, I need to run it every time that W3TC saves a new configuration.

    https://hookr.io/plugins/w3-total-cache/0.9.3/actions/w3tc_saving_options/

    // define the w3tc_saving_options callback
    function action_w3tc_saving_options( $config, $this__config, $config_admin ) {
        // make action magic happen here...
    }; 
    
    // add the action
    add_action( 'w3tc_saving_options', 'action_w3tc_saving_options', 10, 3 );
    Thread Starter juliosene

    (@juliosene)

    Thanks Nigro,

    Your link are very helpful, however, I need to execute my function after W3TC save the configuration on “master.php” file.

    I tried ‘w3tc_saved_options’ action, but isn’t working. W3TC is saving the “master.php” after this action (overwriting my modified file).

    Thread Starter juliosene

    (@juliosene)

    I had to create a new hook to enable my plugin. I hacked admin.php (\wp-content\plugins\w3-total-cache\inc\functions) and have added a “w3tc_after_save_options”. However, when I save configuration using “General Settings” page, It is not working. It appears that this page saves a new configuration after the admin.php finishing save process.

    (new) admin.php:

    (...)
    /**
         * Update CloudFront CNAMEs
         */
        if ($update_cf_cnames) {
            $error = null;
            $w3_plugin_cdn->update_cnames($error);
        }
    
        /**
         * Rebuild master.php config file
         * */
    //    w3tc_azure_memcached();
    
        do_action('w3tc_after_save_options',$new_config);
    
        return true;
    }
    
    /**
     * Uploads minify files to CDN
     *
     * @return void
     */
    (...)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Dynamic port number for Memchaced – Azure Web App -> Redis Cahe via Memcached’ is closed to new replies.