How to set advancedcache options in WP Config (7 posts)

  1. James Bonham
    Posted 2 years ago #

    How do you suggest doing this in wp-config...

    in advanced-cache.php
    // This is the base configuration. You can edit these variables or move them into your wp-config.php file.

    Adding an example under FAQ would be useful. Thanks in advance.


  2. Andrés Villarreal
    Posted 2 years ago #

    Hi James,

    I'm doing this by having a file named batcache-config.php, which is included in wp-config.php this way:

    if ( file_exists( dirname( __FILE__ ) . '/batcache-config.php' ) ) {
    	include( dirname( __FILE__ ) . '/batcache-config.php' );

    And this is the content of my batcache-config.php:

    // =================
    // Batcache settings
    // =================
    global $batcache;
    $batcache = array(
    	'max_age'           => 300,
    	'remote'            => 0,
    	'times'             => 1,
    	'seconds'           => 0,
    	'group'             => 'batcache',
    	'unique'            => array(),
    	'headers'           => array(),
    	'cache_redirects'   => false,
    	'redirect_status'   => false,
    	'redirect_location' => false,
    	'uncached_headers'  => array( 'transfer-encoding' ),
    	'debug'             => true,
    	'cache_control'     => true,
    	'cancel'            => false,

    I agree with you, an example on how to use a custom configuration would be really great for people who don't like reading the code to know what to do. I hope this helps.

  3. VenturaVan
    Posted 2 years ago #

    @Andrés Villarreal Why do you have debug set to TRUE?

  4. Andrés Villarreal
    Posted 2 years ago #

    If debug is set to true, the information about the served page is displayed. If set to false, the information is hidden.

    The advanced-cache.php specifies this:

    var $debug   = true; // Set false to hide the batcache info <!-- comment -->
  5. perqa
    Posted 2 years ago #

    I get a warning when trying to do this:

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in /Users/per/google-cloud/my-app/wordpress/wp-includes/plugin.php on line 199

    This issue has also been reported on https://github.com/Automattic/batcache/issues/22

  6. Andrés Villarreal
    Posted 2 years ago #


    Can you paste the code you're actually using?

  7. perqa
    Posted 2 years ago #

    Thanks for reaching out so quickly! I have found the cause of the problem: I blindly followed the config instructions provided by Google. Inserting the batcache config *in the right place* in wp-config.php, solved the problem!

    More details provided here: http://stackoverflow.com/questions/21666550/why-is-my-wordpress-site-on-gae-not-being-cached/21749209#21749209.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Batcache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.