I was wondering what people used as a work around for the W3TC plugin? I want to use the CDN minification feature in this plugin, but it mucks up all the config files. What is a good plugin that makes it easy to minify and mirror on an AWS Cloudfront?
Thanks @darjanpanic, but that is expensive, not sure how much it is worth with thatā¦ anything free you have experience with?
Donāt think there are any free ones that would do the same (maybe check WP Super Cache), i would stick with W3 total cache then and just disable the features you donāt need. As W3 total cache is a popular plugin you can google for guides/tutorials on how to do it properly without errors and how others who took time do it. Itās a great plugin if you know what each thing does and what impact it has on other things.
I suggest not using the js/css option to create one js/css file from all the plugins you use, since it will probably be a problem unless you take time and experiment. There is no 1 click option for harder things like this that i know of.
But in the end it can always be different from yours as you wonāt have the same plugins. Trial and error until it works
Also Sage does itās own minify and it works great.
Yes. Why not use Sageās minification? This generally should be part of your gulp production build tasks.
Just to add something to the CDN/caching conversation - I use WP Offload S3 for serving postās/pageās media assets. Iāve tried to use their Assets plugin however their seems to be a bug with the folder structure of Bedrock where WP Offload canāt find and associate theme files. For this task I use W3TC lined into the same S3 account. Iāve been told by Delicious Brains theyāre actively working to find a solution to this Bedrock/Sage theme issue.
Using this current setup my $5 Digital Ocean has withstood pretty high traffic ranging in the lower hundreds of thousands a day.
I found a better way to automate this;
If youāre already using Trellis or Bedrock, you can set a environment variable in your .env, for example:
W3T_CACHE_SECRET="somerandomstring"
Then in your gulpfile, you can read this variable with dotenv:
var dotenv = require('dotenv').config({path: '../../../../.env'});
and use it in your gulp task:
// ### Empty Cache
gulp.task('emptycache', function(cb) {
gulp.src('')
.pipe(emptycache({uri: 'http://yourdomain.com/?w3tcEmptyCache=' + process.env.W3T_CACHE_SECRET}));
});
Then in your extras.php you do the same, but for PHP:
/* This allows us to automatically empty the cache during deployments */
$env = getenv('WP_ENV');
if (!$env || $env === 'production') {
$secret = getenv('W3T_CACHE_SECRET');
}
if ( (!$env || $env === 'production') && !empty($_GET['w3tcEmptyCache']) && $_GET['w3tcEmptyCache'] == $secret && function_exists('w3tc_pgcache_flush') ) {
// Empty the W3 Total Cache
w3tc_pgcache_flush();
die('W3 Total Cache Cleared');
}
Maybe this helps someone.
Are there (still) any Cache plugins recommended by Roots/Bedrock team?
The sites on Trellis are quite fast already without any cache plugins in use
(nginx microcaching and opcache).
Doesnāt the Blade cache (in Sage beta) function like a caching plugin?
I am new to using wp-super-cache, but I just found a comprehensive tutorial by Joe Lambert on how to make it play well with Bedrock and Capistrano here:
http://www.joelambert.co.uk/article/bedrock-with-wp-super-cache/
Itās from 2015 but I hope it still applies.
Anyone got any more recent advice or info on cache plugins that work well with Bedrock?
If you also use Trellis for deployments, I wouldnāt bother using any cache plugins anymore. The fastcgi caching takes care of this.
Thanks for the tip, @Twansparant. Iām using vanilla Bedrock with Apache on Docker for local development and deploying via Capistrano to cheap Cloud hosting (Apache). So I donāt have access to Nginx fastcgi caching at the moment.
Looks like a great solution if I ever move up to an Nginx config on something like Digital Ocean/Linode.