WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. James Bonham
    Member
    Posted 9 months 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.

    http://wordpress.org/plugins/batcache/

  2. Andrés Villarreal
    Member
    Posted 8 months 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:

    <?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
    Member
    Posted 7 months ago #

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

  4. Andrés Villarreal
    Member
    Posted 7 months 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
    Member
    Posted 5 months 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
    Member
    Posted 5 months ago #

    @perqa,

    Can you paste the code you're actually using?

  7. perqa
    Member
    Posted 5 months 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.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.